Skip to content

Commit 4dab6d0

Browse files
committed
cmd/go: make -a apply to the standard library, like in Go 1.3
This CL adds a very long comment explaining how isStale and the new build IDs work. As part of writing the comment I realized: // When the go command makes the wrong build decision and does not // rebuild something it should, users fall back to adding the -a flag. // Any common use of the -a flag should be considered prima facie evidence // that isStale is returning an incorrect false result in some important case. // Bugs reported in the behavior of -a itself should prompt the question // ``Why is -a being used at all? What bug does that indicate?'' The two uses of -a that are most commonly mentioned in bugs filed against the go command are: go install -a ./... go build -tags netgo -a myprog Both of these commands now do the right thing without needing -a. The -a exception we introduced in Go 1.4 was for the first form, and it broke the second form. Again, neither needs -a anymore, so restore the old, simpler, easier to explain, less surprising meaning used in Go 1.3: if -a is given, rebuild EVERYTHING. See the comment for more justification and history. Summary of recent CLs (to link bugs to this one): Fixes #3036. Now 'go install ./...' works. Fixes #6534. Now 'go install ./...' works. Fixes #8290. Now 'go install ./...' works. Fixes #9369. Now 'go build -tags netgo myprog' works. Fixes #10702. Now using one GOPATH with Go 1.5 and Go 1.6 works. (Each time you switch, everything needed gets rebuilt. Switching from Go 1.4 to Go 1.5 will rebuild properly. Switching from Go 1.5 back to Go 1.4 still needs -a when invoking the Go 1.4 go command.) Change-Id: I19f9eb5286efaa50de7c8326602e94604ab572eb Reviewed-on: https://go-review.googlesource.com/10761 Reviewed-by: Ian Lance Taylor <[email protected]>
1 parent 3ab9ff1 commit 4dab6d0

File tree

2 files changed

+354
-73
lines changed

2 files changed

+354
-73
lines changed

Diff for: src/cmd/go/go_test.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -585,7 +585,7 @@ func TestGoBuilDashAInReleaseBranch(t *testing.T) {
585585
tg.run("install", "math") // should be up to date already but just in case
586586
tg.setenv("TESTGO_IS_GO_RELEASE", "1")
587587
tg.run("build", "-v", "-a", "math")
588-
tg.grepStderrNot("runtime", "testgo build -a math in dev branch DID build runtime, but should NOT have")
588+
tg.grepStderr("runtime", "testgo build -a math in dev branch did not build runtime, but should have")
589589
}
590590

591591
func TestGoInstallCleansUpAfterGoBuild(t *testing.T) {

0 commit comments

Comments
 (0)