Skip to content

Commit 0c27690

Browse files
committed
_content/doc: be more specific about build constraint downgrades
The toolchain documentation already mentions that language versions can be set per-file using build constraints. Add more info about how that mechanism works. Fixes golang/go#61894 Change-Id: I4d18cbc3fa94b990b24b164c39e53d9f5a061bbc Reviewed-on: https://go-review.googlesource.com/c/website/+/602936 Reviewed-by: Russ Cox <[email protected]> LUCI-TryBot-Result: Go LUCI <[email protected]>
1 parent 0de4dec commit 0c27690

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

_content/doc/toolchain.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,9 @@ that declares `go 1.22.0`, then *M*'s `go.mod` cannot say `go 1.21.3`.
162162
The `go` line for each module sets the language version the compiler
163163
enforces when compiling packages in that module.
164164
The language version can be changed on a per-file basis by using a
165-
[build constraint](/cmd/go#hdr-Build_constraints).
165+
[build constraint](/cmd/go#hdr-Build_constraints):
166+
if a build constraint is present and implies a minimum version of at least `go1.21`,
167+
the language version used when compiling that file will be that minimum version.
166168

167169
For example, a module containing code that uses the Go 1.21 language version
168170
should have a `go.mod` file with a `go` line such as `go 1.21` or `go 1.21.3`.

0 commit comments

Comments
 (0)