From 8d226da29d95d31b6016a669b6da8f1dd52027c2 Mon Sep 17 00:00:00 2001 From: Ian Lance Taylor Date: Tue, 15 Nov 2016 16:15:05 -0800 Subject: [PATCH] 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 --- src/cmd/go/pkg.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) 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) -- 2.48.1