1
0
mirror of https://github.com/golang/go synced 2024-11-11 20:20:23 -07:00

cmd/go: don't scan gccgo standard library packages for imports

In a gccgo installation the standard library sources are not available.

Change-Id: I929f3645e3ac95a1fa7047d6a3d243159a86ba66
Reviewed-on: https://go-review.googlesource.com/c/go/+/281493
Trust: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Jay Conrod <jayconrod@google.com>
Reviewed-by: Bryan C. Mills <bcmills@google.com>
This commit is contained in:
Ian Lance Taylor 2021-01-04 14:24:40 -08:00
parent 6b37b15d95
commit 1b85e7c057

View File

@ -1083,13 +1083,20 @@ func (ld *loader) load(pkg *loadPkg) {
}
}
imports, testImports, err := scanDir(pkg.dir, ld.Tags)
pkg.inStd = (search.IsStandardImportPath(pkg.path) && search.InDir(pkg.dir, cfg.GOROOTsrc) != "")
var imports, testImports []string
if cfg.BuildContext.Compiler == "gccgo" && pkg.inStd {
// We can't scan standard packages for gccgo.
} else {
var err error
imports, testImports, err = scanDir(pkg.dir, ld.Tags)
if err != nil {
pkg.err = err
return
}
pkg.inStd = (search.IsStandardImportPath(pkg.path) && search.InDir(pkg.dir, cfg.GOROOTsrc) != "")
}
pkg.imports = make([]*loadPkg, 0, len(imports))
var importFlags loadPkgFlags