Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(1443)

Unified Diff: testservices/hook/service_gccgo.go

Issue 141720043: testservices/hook: fix gccgo build failure
Patch Set: testservices/hook: fix gccgo build failure Created 9 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « [revision details] ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: testservices/hook/service_gccgo.go
=== modified file 'testservices/hook/service_gccgo.go'
--- testservices/hook/service_gccgo.go 2014-02-06 00:42:49 +0000
+++ testservices/hook/service_gccgo.go 2014-09-08 06:57:41 +0000
@@ -12,6 +12,9 @@
// versions.
var callerDepth int
+// namePartsPos defines the position within the raw method name, deliniated by periods.
+var namePartsPos = -1 // will panic if we cannot determine the position.
+
type inner struct{}
func (i *inner) m() {
@@ -21,6 +24,12 @@
panic("current method name cannot be found")
}
if name := runtime.FuncForPC(pc).Name(); name == "hook.setCallerDepth" {
+ for i, s := range strings.Split(name, ".") {
+ if s == "setCallerDepth" {
+ namePartsPos = i
+ break
+ }
+ }
return
}
}
@@ -67,8 +76,7 @@
// This is very fragile. fullName will be something like:
// launchpad.net_goose_testservices_novaservice.removeServer.pN49_launchpad.net_goose_testservices_novaservice.Nova
// so if the number of dots in the full package path changes,
- // this will need to too...
- const namePartsPos = 2
+ // We try to figure sniff this value at the top, but it may not work.
nameParts := strings.Split(fullName, ".")
return nameParts[namePartsPos]
}
« no previous file with comments | « [revision details] ('k') | no next file » | no next file with comments »

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b