]> Cypherpunks repositories - gostls13.git/commitdiff
cmd/go: runtime and runtime/internal packages depend on runtime/internal/sys
authorIan Lance Taylor <iant@golang.org>
Thu, 17 Dec 2015 18:29:12 +0000 (10:29 -0800)
committerIan Lance Taylor <iant@golang.org>
Thu, 17 Dec 2015 19:37:18 +0000 (19:37 +0000)
Fixes #13655.

Change-Id: I764019aecdd59743baa436b7339499e6c2126268
Reviewed-on: https://go-review.googlesource.com/17916
Run-TryBot: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Russ Cox <rsc@golang.org>
src/cmd/go/go_test.go
src/cmd/go/pkg.go

index 20d3d4052f27e545f96863b92579136a4787e127..f3dbe85c01208429381eb25772b279ea65956ce0 100644 (file)
@@ -2454,3 +2454,12 @@ func TestGoBuildARM(t *testing.T) {
        tg.run("build", "hello.go")
        tg.grepStderrNot("unable to find math.a", "did not build math.a correctly")
 }
+
+func TestIssue13655(t *testing.T) {
+       tg := testgo(t)
+       defer tg.cleanup()
+       for _, pkg := range []string{"runtime", "runtime/internal/atomic"} {
+               tg.run("list", "-f", "{{.Deps}}", pkg)
+               tg.grepStdout("runtime/internal/sys", "did not find required dependency of "+pkg+" on runtime/internal/sys")
+       }
+}
index 2f8799a608295c2759039f1dbbe5bda96a83f89d..3361fc32005921c162668916f2480e5237b844be 100644 (file)
@@ -835,6 +835,14 @@ func (p *Package) load(stk *importStack, bp *build.Package, err error) *Package
                }
        }
 
+       // Runtime and its internal packages depend on runtime/internal/sys,
+       // so that they pick up the generated zversion.go file.
+       // This can be an issue particularly for runtime/internal/atomic;
+       // see issue 13655.
+       if p.Standard && (p.ImportPath == "runtime" || strings.HasPrefix(p.ImportPath, "runtime/internal/")) && p.ImportPath != "runtime/internal/sys" {
+               importPaths = append(importPaths, "runtime/internal/sys")
+       }
+
        // Build list of full paths to all Go files in the package,
        // for use by commands like go fmt.
        p.gofiles = stringList(p.GoFiles, p.CgoFiles, p.TestGoFiles, p.XTestGoFiles)