-
Notifications
You must be signed in to change notification settings - Fork 17.7k
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
x/tools/gopls: evaluation of build tags used in imported packages must be optional #68549
Comments
This should not happen. Perhaps for the particular set of tags selected, there really are redeclarations? And sorry for the poor experience here. This should be improved. Generally, I think we should consider (1) restricting diagnostics for "dynamic" build tags only to open packages, and (2) implementing #65757 to specify a fixed set of builds (which would implicitly disable dynamic build selection. |
Yes, gopls maintains on-disk cache.
I can guess two reasons:
@findleyr Why/how gopls happened to pick up |
Go version
go1.22.3 windows/amd64
gopls v0.16.1
Output of
go env
in your module/workspace:What did you do?
While dealing with endianness, I introduced build tags to a package which has its own
go.mod
. After the change, one file would contain//go:build 386 || amd64 || amd64p32 || alpha || arm || arm64 || loong64 || mipsle || mips64le || mips64p32le || nios2 || ppc64le || riscv || riscv64 || sh || wasm
and another would contain
//go:build armbe || arm64be || m68k || mips || mips64 || mips64p32 || ppc || ppc64 || s390 || s390x || shbe || sparc || sparc64
As a consequence, all code importing this package is now evaluated for GOOS=aix with GOARCH=ppc64, causing a large amount of problems to be marked, making me lose of track of actual problems.
Additionally, type redeclarations are detected in spite of the build tags being disjoint. (?)
To fix it, I specified
"go.buildTags": "amd64"
in.vscode/settings.json
.What did you see happen?
Compilation errors for architectures other than
amd64
are still being reported.What did you expect to see?
That gopls would no longer report compilation errors for architectures other than amd64.
The text was updated successfully, but these errors were encountered: