aboutsummaryrefslogtreecommitdiff
path: root/src/cmd/dist
diff options
context:
space:
mode:
authorDaniel Martí <mvdan@mvdan.cc>2022-07-05 15:57:37 +0100
committerDaniel Martí <mvdan@mvdan.cc>2022-10-01 08:31:45 +0000
commitef1c70fbde3acb3d0865b8c12e75e6dcb65653d3 (patch)
tree83bc9245a4308acabd02b4ccc30d9e0f642d0b55 /src/cmd/dist
parent738a2caf089a195724041df58778a7e94fc7b80b (diff)
downloadgo-ef1c70fbde3acb3d0865b8c12e75e6dcb65653d3.tar.xz
cmd/go: remove the -i build flag
The flag is now removed from `go build` and `go test`. It has been deprecated since Go 1.16, printing a warning message. The idea was to fully delete it in Go 1.17, but that didn't happen. First, delete the BuildI variable and its flag declarations, as well as all the bits of docs that mentioned the flag. Second, delete or simplify the code paths that used BuildI. Third, adapt the tests to the removed flag. Some of them are removed, like test_relative_import_dash_i.txt and TestGoTestDashIDashOWritesBinary, as they centered around the flag. The rest are modified to not cover or use the flag. Finally, change cmd/dist to no longer use `go install -i`. The purpose of the flag was that, when bootstrapping the toolchain, all of its dependencies would also be installed as object files. When removing the use of the -i flags, the checkNotStale call right after building toolchain3 would fail as expected, because runtime/internal/sys is now only up to date in the build cache. Luckily, that's not a problem: we run `go install std cmd` right after, so all standard library packages will be installed as object files. Move the checkNotStale call after that install command. Fixes #41696. Change-Id: I5d8139f18aaee07da886d483e663f3f2f00d5f3a Reviewed-on: https://go-review.googlesource.com/c/go/+/416094 Reviewed-by: Bryan Mills <bcmills@google.com> Reviewed-by: Dmitri Shuralyov <dmitshur@google.com> Run-TryBot: Daniel Martí <mvdan@mvdan.cc> TryBot-Result: Gopher Robot <gobot@golang.org>
Diffstat (limited to 'src/cmd/dist')
-rw-r--r--src/cmd/dist/build.go6
-rw-r--r--src/cmd/dist/test.go6
2 files changed, 6 insertions, 6 deletions
diff --git a/src/cmd/dist/build.go b/src/cmd/dist/build.go
index dae8531466..b51f56dc44 100644
--- a/src/cmd/dist/build.go
+++ b/src/cmd/dist/build.go
@@ -1359,7 +1359,7 @@ func cmdbootstrap() {
os.Setenv("CC", compilerEnvLookup(defaultcc, goos, goarch))
// Now that cmd/go is in charge of the build process, enable GOEXPERIMENT.
os.Setenv("GOEXPERIMENT", goexperiment)
- goInstall(goBootstrap, append([]string{"-i"}, toolchain...)...)
+ goInstall(goBootstrap, toolchain...)
if debug {
run("", ShowOutput|CheckExit, pathf("%s/compile", tooldir), "-V=full")
run("", ShowOutput|CheckExit, pathf("%s/buildid", tooldir), pathf("%s/pkg/%s_%s/runtime/internal/sys.a", goroot, goos, goarch))
@@ -1387,13 +1387,12 @@ func cmdbootstrap() {
xprintf("\n")
}
xprintf("Building Go toolchain3 using go_bootstrap and Go toolchain2.\n")
- goInstall(goBootstrap, append([]string{"-a", "-i"}, toolchain...)...)
+ goInstall(goBootstrap, append([]string{"-a"}, toolchain...)...)
if debug {
run("", ShowOutput|CheckExit, pathf("%s/compile", tooldir), "-V=full")
run("", ShowOutput|CheckExit, pathf("%s/buildid", tooldir), pathf("%s/pkg/%s_%s/runtime/internal/sys.a", goroot, goos, goarch))
copyfile(pathf("%s/compile3", tooldir), pathf("%s/compile", tooldir), writeExec)
}
- checkNotStale(goBootstrap, append(toolchain, "runtime/internal/sys")...)
if goos == oldgoos && goarch == oldgoarch {
// Common case - not setting up for cross-compilation.
@@ -1428,6 +1427,7 @@ func cmdbootstrap() {
}
targets := []string{"std", "cmd"}
goInstall(goBootstrap, targets...)
+ checkNotStale(goBootstrap, append(toolchain, "runtime/internal/sys")...)
checkNotStale(goBootstrap, targets...)
checkNotStale(cmdGo, targets...)
if debug {
diff --git a/src/cmd/dist/test.go b/src/cmd/dist/test.go
index d27afb9fa1..7f85fc1d2d 100644
--- a/src/cmd/dist/test.go
+++ b/src/cmd/dist/test.go
@@ -136,7 +136,7 @@ func (t *tester) run() {
if t.rebuild {
t.out("Building packages and commands.")
// Force rebuild the whole toolchain.
- goInstall("go", append([]string{"-a", "-i"}, toolchain...)...)
+ goInstall("go", append([]string{"-a"}, toolchain...)...)
}
if !t.listMode {
@@ -153,8 +153,8 @@ func (t *tester) run() {
// to break if we don't automatically refresh things here.
// Rebuilding is a shortened bootstrap.
// See cmdbootstrap for a description of the overall process.
- goInstall("go", append([]string{"-i"}, toolchain...)...)
- goInstall("go", append([]string{"-i"}, toolchain...)...)
+ goInstall("go", toolchain...)
+ goInstall("go", toolchain...)
goInstall("go", "std", "cmd")
} else {
// The Go builder infrastructure should always begin running tests from a