From: Michael Matloob Date: Thu, 19 Nov 2015 19:09:33 +0000 (-0500) Subject: cmd/compile: identify the runtime pkg using myimportpath X-Git-Tag: go1.6beta1~377 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=45c3cf68b024e99ddf046e2a858452ea51d84749;p=gostls13.git cmd/compile: identify the runtime pkg using myimportpath Because there are now multiple packages that compose the runtime we need to distinguish between the case where a runtime package is being compiled versus the case the "runtime" package is being compiled. In golang.org/cl/14204 I mistakenly used localpkg.Name == "runtime" to check against the "runtime" package, but doing this would treat a package with the path "foo.org/bar/runtime" as the runtime package. The correct check is myimportpath == "runtime" . Change-Id: If90e95cef768d91206f2df1c06e27be876722e4e Reviewed-on: https://go-review.googlesource.com/17059 Run-TryBot: Michael Matloob Reviewed-by: Russ Cox --- diff --git a/src/cmd/compile/internal/gc/reflect.go b/src/cmd/compile/internal/gc/reflect.go index deaeb4606c..264955c702 100644 --- a/src/cmd/compile/internal/gc/reflect.go +++ b/src/cmd/compile/internal/gc/reflect.go @@ -989,7 +989,7 @@ func dtypesym(t *Type) *Sym { dupok = obj.DUPOK } - if localpkg.Name == "runtime" && (tbase == Types[tbase.Etype] || tbase == bytetype || tbase == runetype || tbase == errortype) { // int, float, etc + if myimportpath == "runtime" && (tbase == Types[tbase.Etype] || tbase == bytetype || tbase == runetype || tbase == errortype) { // int, float, etc goto ok } @@ -1266,7 +1266,7 @@ func dumptypestructs() { // so this is as good as any. // another possible choice would be package main, // but using runtime means fewer copies in .6 files. - if localpkg.Name == "runtime" { + if myimportpath == "runtime" { for i := EType(1); i <= TBOOL; i++ { dtypesym(Ptrto(Types[i])) }