diff options
| author | Michael Matloob <matloob@golang.org> | 2024-08-05 11:21:57 -0400 |
|---|---|---|
| committer | Michael Matloob <matloob@golang.org> | 2024-12-19 07:35:55 -0800 |
| commit | 0c276906eee755d651c697f85abc03d6aeb9250d (patch) | |
| tree | cfcddbf39f9081db62d46cedfb3d51b36d4d0a91 | |
| parent | 0de4dec220b4a8ed6929431283ea89ceafaf3c83 (diff) | |
| download | go-x-website-0c276906eee755d651c697f85abc03d6aeb9250d.tar.xz | |
_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 <rsc@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
| -rw-r--r-- | _content/doc/toolchain.md | 4 |
1 files changed, 3 insertions, 1 deletions
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`. |
