diff --git a/doc/go1.20.html b/doc/go1.20.html index ebefbe6e06..aaa811e595 100644 --- a/doc/go1.20.html +++ b/doc/go1.20.html @@ -51,28 +51,66 @@ Do not send CLs removing the interior tags from such phrases.
- TODO: https://go.dev/cl/421440: cmd/go: add go generate -skip flag +
+ The directory $GOROOT/pkg no longer stores
+ pre-compiled package archives for the standard library:
+ go install no longer writes them,
+ the go build no longer checks for them,
+ and the Go distribution no longer ships them.
+ Instead, packages in the standard library are built as needed
+ and cached in the build cache, just like packages outside GOROOT.
+ This change reduces the size of the Go distribution and also
+ avoids C toolchain skew for packages that use cgo.
+
+ The implementation of go test -json
+ has been improved to make it more robust.
+ Programs that run go test -json
+ do not need any updates.
+ Programs that invoke go tool test2json
+ directly should now run the test binary with -v=json
+ (for example, go test -v=json
+ or ./pkg.test -test.v=json)
+ instead of plain -v.
+
+ A related change to go test -json
+ is the addition of an event with Action set to start
+ at the beginning of each test program's execution.
+ When running multiple tests using the go command,
+ these start events are guaranteed to be emitted in the same order as
+ the packages named on the command line.
TODO: https://go.dev/issue/45454: provide build tags for architecture environment variables
-- TODO: CL 448357: cmd/go: print test2json start events +
+ The go subcommands now accept
+ -C <dir> to change directory to <dir>
+ before performing the command, which may be useful for scripts that need to
+ execute commands in multiple different modules.
- The Go distribution no longer ships with pre-compiled .a
- files for most of the packages in GOROOT, now only including
- .a files for the five packages in GOROOT that use cgo.
- Instead, those packages will be built as needed and cached in the build
- cache, as is already done for non-main packages outside
- GOROOT. Further, go install will
- also not install .a files for GOROOT packages
- except for those that use cgo. These changes are intended to
- reduce the size of the Go distribution, in some cases by up to two-thirds.
+
+ The go build and go test
+ commands no longer accept the -i flag,
+ which has been deprecated since Go 1.16.
+
+ The go generate command now accepts
+ -skip <pattern> to skip //go:generate directives
+ matching <pattern>.
+
+ The go test command now accepts
+ -skip <pattern> to skip tests, subtests, or examples
+ matching <pattern>.
@@ -86,25 +124,6 @@ Do not send CLs removing the interior tags from such phrases.
the GOPATH install targets to unexpectedly remain in effect.)
- The -i flag is no longer accepted by
- go build and go test.
- The flag has been deprecated since Go 1.16.
-
- The go subcommands now accept
- -C <dir> to change directory to <dir>
- before performing the command, which may be useful for scripts that need to
- execute commands in multiple different modules.
-
- The go test command now accepts
- -skip <pattern> to skip tests or subtests
- matching <pattern>.
-
go version@@ -114,6 +133,47 @@ Do not send CLs removing the interior tags from such phrases. and Linux binaries without execute permission.
+
+ The go command now disables cgo by default
+ on systems without a C toolchain.
+ More specifically, when the CGO_ENABLED environment variable is unset,
+ the CC environment variable is unset,
+ and the default C compiler (typically clang or gcc)
+ is not found in the path,
+ CGO_ENABLED defaults to 0.
+ As always, you can override the default by setting CGO_ENABLED explicitly.
+
+ The most important effect of the default change is that when Go is installed + on a system without a C compiler, it will now use pure Go builds for packages + in the standard library that use cgo, instead of using pre-distributed package archives + (which have been removed, as noted above) + or attempting to use cgo and failing. + This makes Go work better in some minimal container environments + as well as on macOS, where pre-distributed package archives have + not been used for cgo-based packages since Go 1.16. +
+ ++ The packages in the standard library that use cgo are net, + os/user, and + plugin. + On macOS, the net and os/user packages have been rewritten not to use cgo: + the same code is now used for cgo and non-cgo builds as well as cross-compiled builds. + On Windows, the net and os/user packages have never used cgo. + On other systems, builds with cgo disabled will use a pure Go version of these packages. +
+ ++ On macOS, the race detector has been rewritten not to use cgo: + race-detector-enabled programs can be built and run without Xcode. + On Linux and other Unix systems, and on Windows, a host C toolchain + is required to use the race detector. +
+@@ -630,7 +690,7 @@ proxyHandler := &httputil.ReverseProxy{
- HTTP/2 stream errors returned by net/http functions may be converted
+ HTTP/2 stream errors returned by net/http functions may be converted
to a "golang.org/x/net/http2".StreamError using errors.As.