]> Cypherpunks repositories - gostls13.git/commitdiff
cmd/dist, cmd/go: make GODEBUG=godebughash=1 ./make.bash work better
authorRuss Cox <rsc@golang.org>
Mon, 6 Nov 2017 00:35:14 +0000 (19:35 -0500)
committerRuss Cox <rsc@golang.org>
Mon, 6 Nov 2017 20:20:47 +0000 (20:20 +0000)
The change in cmd/dist ignores debug output, instead of assuming
any output is from the template.

The change in cmd/go makes the debug output show the package name
on every line, so that interlaced prints can be deinterlaced.

Change-Id: Ic3d59ee0256271067cb9be2fde643a0e19405375
Reviewed-on: https://go-review.googlesource.com/76019
Run-TryBot: Russ Cox <rsc@golang.org>
Reviewed-by: David Crawshaw <crawshaw@golang.org>
src/cmd/dist/build.go
src/cmd/go/internal/work/exec.go

index a2f3a8c2822209933a45dd1a9bac8bc8e0fef142..107990ea47db4c0c212fd20a7cbbd607c3b50da1 100644 (file)
@@ -1309,12 +1309,12 @@ func checkNotStale(goBinary string, targets ...string) {
                append([]string{
                        goBinary,
                        "list", "-gcflags=" + gogcflags, "-ldflags=" + goldflags,
-                       "-f={{if .Stale}}\t{{.ImportPath}}: {{.StaleReason}}{{end}}",
+                       "-f={{if .Stale}}\tSTALE {{.ImportPath}}: {{.StaleReason}}{{end}}",
                }, targets...)...)
-       if out != "" {
+       if strings.Contains(out, "\tSTALE ") {
                os.Setenv("GODEBUG", "gocachehash=1")
                for _, target := range []string{"runtime/internal/sys", "cmd/dist", "cmd/link"} {
-                       if strings.Contains(out, target) {
+                       if strings.Contains(out, "STALE "+target) {
                                run(goroot, ShowOutput|CheckExit, goBinary, "list", "-f={{.ImportPath}} {{.Stale}}", target)
                                break
                        }
index d43a5f2417f0d362e026d4b5fb206dec94a92ca3..39b39fa9de7b61180c69954ccc2ea1e16a8d3149 100644 (file)
@@ -168,8 +168,8 @@ func (b *Builder) Do(root *Action) {
 
 // buildActionID computes the action ID for a build action.
 func (b *Builder) buildActionID(a *Action) cache.ActionID {
-       h := cache.NewHash("actionID")
        p := a.Package
+       h := cache.NewHash("build " + p.ImportPath)
 
        // Configuration independent of compiler toolchain.
        // Note: buildmode has already been accounted for in buildGcflags
@@ -667,8 +667,8 @@ func (b *Builder) vet(a *Action) error {
 
 // linkActionID computes the action ID for a link action.
 func (b *Builder) linkActionID(a *Action) cache.ActionID {
-       h := cache.NewHash("link")
        p := a.Package
+       h := cache.NewHash("link " + p.ImportPath)
 
        // Toolchain-independent configuration.
        fmt.Fprintf(h, "link\n")