cmd/go: add constant for requires simplification

This change introduces a new constant `SimplifyRequireVersion` in
preparation for making go.mod files to have at most two require blocks
(one for direct and one for indirect dependencies) when the go version
is 1.27 or higher.

For #56471.

Change-Id: I0dab5c93815dc0dfc5596ff8af00d364a716ae89
Reviewed-on: https://go-review.googlesource.com/c/go/+/738740
Reviewed-by: Michael Pratt <mpratt@google.com>
LUCI-TryBot-Result: golang-scoped@luci-project-accounts.iam.gserviceaccount.com <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Michael Matloob <matloob@google.com>
Reviewed-by: Michael Matloob <matloob@golang.org>
This commit is contained in:
Ian Alexander 2026-01-24 21:11:52 -05:00
parent 58efaf3859
commit 922abf576d

View file

@ -36,11 +36,16 @@ const (
// the module graph; see https://golang.org/ref/mod#graph-pruning.
ExplicitIndirectVersion = "1.17"
// separateIndirectVersion is the Go version at which
// SeparateIndirectVersion is the Go version at which
// "// indirect" dependencies are added in a block separate from the direct
// ones. See https://golang.org/issue/45965.
SeparateIndirectVersion = "1.17"
// SimplifyRequireVersion is the Go version at which
// require blocks are simplified to always have at most two sections
// (one direct, one indirect). See https://go.dev/issue/56471.
SimplifyRequireVersion = "1.27"
// tidyGoModSumVersion is the Go version at which
// 'go mod tidy' preserves go.mod checksums needed to build test dependencies
// of packages in "all", so that 'go test all' can be run without checksum