From 0c276906eee755d651c697f85abc03d6aeb9250d Mon Sep 17 00:00:00 2001 From: Michael Matloob Date: Mon, 5 Aug 2024 11:21:57 -0400 Subject: _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 LUCI-TryBot-Result: Go LUCI --- _content/doc/toolchain.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/_content/doc/toolchain.md b/_content/doc/toolchain.md index c0f14809..bb53ee6d 100644 --- a/_content/doc/toolchain.md +++ b/_content/doc/toolchain.md @@ -162,7 +162,9 @@ that declares `go 1.22.0`, then *M*'s `go.mod` cannot say `go 1.21.3`. The `go` line for each module sets the language version the compiler enforces when compiling packages in that module. The language version can be changed on a per-file basis by using a -[build constraint](/cmd/go#hdr-Build_constraints). +[build constraint](/cmd/go#hdr-Build_constraints): +if a build constraint is present and implies a minimum version of at least `go1.21`, +the language version used when compiling that file will be that minimum version. For example, a module containing code that uses the Go 1.21 language version should have a `go.mod` file with a `go` line such as `go 1.21` or `go 1.21.3`. -- cgit v1.3