Skip to content

Commit

Permalink
_content/doc: be more specific about build constraint downgrades
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
matloob committed Dec 19, 2024
1 parent 0de4dec commit 0c27690
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion _content/doc/toolchain.md
Original file line number Diff line number Diff line change
Expand Up @@ -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`.
Expand Down

0 comments on commit 0c27690

Please sign in to comment.