-
Notifications
You must be signed in to change notification settings - Fork 17.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
doc: mention language downgrading via //go:build
#61894
Comments
CC @rsc |
I got bitten by this in #64308 where implementing a polyfill for a previous version of the compiler would not work: //go:build !go1.21
package main
// min is a pseudo-polyfill for go1.21 min function
func min(a, b int) int {
if a < b {
return a
}
return b
} Currently the doc states:
It would be helpful to add something like:
|
the language version declared by the Edit: I just realized that this is only relevant for builtins (since stdlib or syntax changes require 2 mutually excluding Go files) |
Change https://go.dev/cl/595475 mentions this issue: |
This change adds documentation for language version downgrading using build constraints. Fixes #68161 For #61894 Change-Id: I283a51afd7020c9fd1f5469a6a93fd814ba32f7e Reviewed-on: https://go-review.googlesource.com/c/go/+/595475 Reviewed-by: Robert Findley <[email protected]> LUCI-TryBot-Result: Go LUCI <[email protected]>
This change adds documentation for language version downgrading using build constraints. Fixes golang#68161 For golang#61894 Change-Id: I283a51afd7020c9fd1f5469a6a93fd814ba32f7e Reviewed-on: https://go-review.googlesource.com/c/go/+/595475 Reviewed-by: Robert Findley <[email protected]> LUCI-TryBot-Result: Go LUCI <[email protected]>
Change https://go.dev/cl/602936 mentions this issue: |
Reading https://go.dev/doc/toolchain, only upgrading the language version on a per-file basis is shown, not downgrading.
It does say that
but that's a bit implicit, considering this is a major change from how module versions and build constraints used to interact.
https://pkg.go.dev/cmd/go#hdr-Build_constraints doesn't mention the semantics of version build constraints, either.
The text was updated successfully, but these errors were encountered: