diff options
Diffstat (limited to 'libgo/go')
-rw-r--r-- | libgo/go/cmd/go/build.go | 9 | ||||
-rw-r--r-- | libgo/go/cmd/go/pkg.go | 8 | ||||
-rw-r--r-- | libgo/go/cmd/go/test.go | 17 |
3 files changed, 20 insertions, 14 deletions
diff --git a/libgo/go/cmd/go/build.go b/libgo/go/cmd/go/build.go index 95b9804..22d37f3 100644 --- a/libgo/go/cmd/go/build.go +++ b/libgo/go/cmd/go/build.go @@ -132,7 +132,8 @@ var buildLdflags []string // -ldflags flag var buildGccgoflags []string // -gccgoflags flag var buildRace bool // -race flag -var reqPkgSrc bool // req src for Imports +// Require the source for go std packages +var reqStdPkgSrc bool var buildContext = build.Default var buildToolchain toolchain = noToolchain{} @@ -187,9 +188,9 @@ func addBuildFlags(cmd *Command) { cmd.Flag.BoolVar(&buildRace, "race", false, "") switch build.Default.Compiler { case "gc": - reqPkgSrc = true + reqStdPkgSrc = true case "gccgo": - reqPkgSrc = false + reqStdPkgSrc = false } } @@ -579,7 +580,7 @@ func (b *builder) action(mode buildMode, depMode buildMode, p *Package) *action // are writing is not the cgo we need to use. if goos == runtime.GOOS && goarch == runtime.GOARCH && !buildRace { - if reqPkgSrc { + if reqStdPkgSrc { if len(p.CgoFiles) > 0 || p.Standard && p.ImportPath == "runtime/cgo" { var stk importStack p1 := loadPackage("cmd/cgo", &stk) diff --git a/libgo/go/cmd/go/pkg.go b/libgo/go/cmd/go/pkg.go index 621cb4b..62f6b4a 100644 --- a/libgo/go/cmd/go/pkg.go +++ b/libgo/go/cmd/go/pkg.go @@ -112,7 +112,11 @@ func (p *Package) copyBuild(pp *build.Package) { p.ConflictDir = pp.ConflictDir // TODO? Target p.Goroot = pp.Goroot - p.Standard = p.Goroot && p.ImportPath != "" && !strings.Contains(p.ImportPath, ".") + if buildContext.Compiler == "gccgo" { + p.Standard = stdpkg[p.ImportPath] + } else { + p.Standard = p.Goroot && p.ImportPath != "" && !strings.Contains(p.ImportPath, ".") + } p.GoFiles = pp.GoFiles p.CgoFiles = pp.CgoFiles p.IgnoredGoFiles = pp.IgnoredGoFiles @@ -582,7 +586,7 @@ func (p *Package) load(stk *importStack, bp *build.Package, err error) *Package continue } p1 := loadImport(path, p.Dir, stk, p.build.ImportPos[path]) - if !reqPkgSrc && p1.Root == "" { + if !reqStdPkgSrc && p1.Standard { continue } if p1.local { diff --git a/libgo/go/cmd/go/test.go b/libgo/go/cmd/go/test.go index 28b46ff..cc0a9ac 100644 --- a/libgo/go/cmd/go/test.go +++ b/libgo/go/cmd/go/test.go @@ -384,17 +384,18 @@ func runTest(cmd *Command, args []string) { delete(deps, "unsafe") all := []string{} - if reqPkgSrc { - for path := range deps { - if !build.IsLocalImport(path) { - all = append(all, path) - } + for path := range deps { + if !build.IsLocalImport(path) { + all = append(all, path) } } sort.Strings(all) a := &action{} for _, p := range packagesForBuild(all) { + if !reqStdPkgSrc && p.Standard { + continue + } a.deps = append(a.deps, b.action(modeInstall, modeInstall, p)) } b.do(a) @@ -563,7 +564,7 @@ func (b *builder) test(p *Package) (buildAction, runAction, printAction *action, stk.push(p.ImportPath + " (test)") for _, path := range p.TestImports { p1 := loadImport(path, p.Dir, &stk, p.build.TestImportPos[path]) - if !reqPkgSrc && p1.Root == "" { + if !reqStdPkgSrc && p1.Standard { continue } if p1.Error != nil { @@ -591,7 +592,7 @@ func (b *builder) test(p *Package) (buildAction, runAction, printAction *action, continue } p1 := loadImport(path, p.Dir, &stk, p.build.XTestImportPos[path]) - if !reqPkgSrc && p1.Root == "" { + if !reqStdPkgSrc && p1.Standard { continue } if p1.Error != nil { @@ -722,7 +723,7 @@ func (b *builder) test(p *Package) (buildAction, runAction, printAction *action, pmain.imports = append(pmain.imports, ptest) } else { p1 := loadImport(dep, "", &stk, nil) - if !reqPkgSrc && p1.Root == "" { + if !reqStdPkgSrc && p1.Standard { continue } if p1.Error != nil { |