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
cmd/go: always pass -lang to cmd/compile #66092
Comments
This is closely related to
However, in the absence of any |
CC @golang/compiler |
@bcmills |
In runtime/compiler triage, we think this is a Go command issue? Is that right? Thanks. |
I think it is a composite of a The |
-lang
is not set
Will this be fixed in 1.22.3+? |
When no -lang is specified, in general we don't know how to interpret cc: @rsc for input. |
Is it a good idea to use the version of the |
@go101 Is the top comment wrong? It says got true, expected false for |
I mean the |
I'm just trying to puzzle through this all since I don't know what "gotv 1.22." does either... |
|
For future bug reports it would help to use reproduction instructions that are limited to standard tooling. |
Here is a clearer reproduction case:
|
CL 567435 in progress should fix this. The fix is to just make sure that cmd/go passes -lang to the compiler always. I looked into changing what the compiler does when -lang is empty, but right now it intentionally ignores the //go:build lines to avoid downgrades, and for good reason (for example see GOROOT/src/internal/types/testdata/check/go1_xx_19.go). If we change the compiler, we risk breaking other uses of the compiler like Bazel. And the go command needs the logic anyway to help cmd/vet, so we might as well just make sure the go command always makes the decision. |
-lang
is not set
Change https://go.dev/cl/567435 mentions this issue: |
Go version
go version go1.22.0 linux/amd64
Output of
go env
in your module/workspace:.
What did you do?
main.go:
What did you see happen?
What did you expect to see?
Note that when the
-gcflags=-lang=go1.22
compiler flag is specified, then the "//go:build go1.xy" comment directive is respected (go run .
with a go.mod file also respects it).The text was updated successfully, but these errors were encountered: