From: Ian Lance Taylor Date: Wed, 16 Nov 2016 00:15:05 +0000 (-0800) Subject: cmd/go: don't check standard packages when using gccgo X-Git-Tag: go1.8beta1~88 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=8d226da29d95d31b6016a669b6da8f1dd52027c2;p=gostls13.git cmd/go: don't check standard packages when using gccgo The gccgo compiler does not have the standard packages available, so it can not check for violations of internal references. Also, the gccgo compiler can not read runtime/internal/sys/zversion.go; in fact, the file does not even exist for gccgo. Change-Id: Ibadf16b371621ad1b87b6e858c5eb233913e179d Reviewed-on: https://go-review.googlesource.com/33295 Run-TryBot: Ian Lance Taylor TryBot-Result: Gobot Gobot Reviewed-by: Brad Fitzpatrick --- diff --git a/src/cmd/go/pkg.go b/src/cmd/go/pkg.go index 064a428703..8b31d2f64d 100644 --- a/src/cmd/go/pkg.go +++ b/src/cmd/go/pkg.go @@ -586,6 +586,11 @@ func disallowInternal(srcDir string, p *Package, stk *importStack) *Package { return p } + // We can't check standard packages with gccgo. + if buildContext.Compiler == "gccgo" && p.Standard { + return p + } + // The stack includes p.ImportPath. // If that's the only thing on the stack, we started // with a name given on the command line, not an @@ -1634,7 +1639,7 @@ func computeBuildID(p *Package) { // Include the content of runtime/internal/sys/zversion.go in the hash // for package runtime. This will give package runtime a // different build ID in each Go release. - if p.Standard && p.ImportPath == "runtime/internal/sys" { + if p.Standard && p.ImportPath == "runtime/internal/sys" && buildContext.Compiler != "gccgo" { data, err := ioutil.ReadFile(filepath.Join(p.Dir, "zversion.go")) if err != nil { fatalf("go: %s", err)