aboutsummaryrefslogtreecommitdiff
path: root/libgo/go
diff options
context:
space:
mode:
authorIan Lance Taylor <iant@google.com>2015-03-24 19:50:31 +0000
committerIan Lance Taylor <ian@gcc.gnu.org>2015-03-24 19:50:31 +0000
commitab24432b9ab95cc0e12cb5ae298fffbda04b3202 (patch)
tree278377d41dceea14428baa5d9f4bef9167baf464 /libgo/go
parenta9f0423f312c2c117185f24dcfd3cba617bc6f8c (diff)
downloadgcc-ab24432b9ab95cc0e12cb5ae298fffbda04b3202.zip
gcc-ab24432b9ab95cc0e12cb5ae298fffbda04b3202.tar.gz
gcc-ab24432b9ab95cc0e12cb5ae298fffbda04b3202.tar.bz2
re PR go/65462 (Use of 'go get' with gccgo is not finding dependencies correctly)
PR go/65462 cmd: Fix dependencies for 'go get' with gccgo Problem described in GCC BZ 65462. Generate the list of the standard GO package names based on what was built into libgo in the libgo Makefile. Change the var name from reqPkgSrc to reqStdPkgSrc to clarify it only affects standard GO packages. Skip the attempted loading of a package only if it is a standard GO package and the flag is set indicating its source is not required to be available. This requires a corresponding change to gotools to build and link in the new file containing the list of standard GO package names that was generated by the libgo Makefile. gotools/: PR go/65462 * Makefile.am (go_cmd_go_files): Add $(libgodir)/zstdpkglist.go. * Makefile.in: Rebuild. From-SVN: r221643
Diffstat (limited to 'libgo/go')
-rw-r--r--libgo/go/cmd/go/build.go9
-rw-r--r--libgo/go/cmd/go/pkg.go8
-rw-r--r--libgo/go/cmd/go/test.go17
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 {