From 97294c2e6e681f4c539ab151abc6ce4ed0d0d28b Mon Sep 17 00:00:00 2001 From: Michael Matloob Date: Sat, 20 Dec 2025 11:01:52 -0500 Subject: _content/doc/go1.26: add note for lower go mod init go directive version Change-Id: I4518c037238cd6316320e78381da76016a6a6964 Reviewed-on: https://go-review.googlesource.com/c/website/+/731720 Reviewed-by: Michael Matloob LUCI-TryBot-Result: Go LUCI Reviewed-by: Dmitri Shuralyov Auto-Submit: Michael Matloob Reviewed-by: Dmitri Shuralyov --- _content/doc/go1.26.md | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/_content/doc/go1.26.md b/_content/doc/go1.26.md index 39a220c9..7361ef70 100644 --- a/_content/doc/go1.26.md +++ b/_content/doc/go1.26.md @@ -49,6 +49,17 @@ func yearsSince(t time.Time) int { ### Go command {#go-command} + +`go mod init` now defaults to a lower `go` version in new `go.mod` files. `go mod init` +using a toolchain of version `1.N.X` will create a `go.mod` file +specifying the Go version `go 1.(N-1).0`. Pre-release versions of `1.N` will +create `go.mod` files specifying `go 1.(N-2).0`. In practice, this means Go 1.26 +release candidates will create `go.mod` files with `go 1.24.0`, and Go 1.26 +and its minor releases will create `go.mod` files with `go 1.25.0`. This is intended +to encourage the creation of modules that are compatible with currently supported +versions of Go. For additional control over the `go` version in new modules, +`go mod init` can be followed up with `go get go@version`. + `cmd/doc`, and `go tool doc` have been deleted. `go doc` can be used as a replacement for `go tool doc`: it takes the same flags and arguments and -- cgit v1.3