-
Notifications
You must be signed in to change notification settings - Fork 18k
cmd/vet: redeclaration errors when GOFLAGS
includes a tag for a different GOOS
#64179
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
Comments
Just found this one: #45488 - Are there any workarounds? |
@powellnorma, don't set tags in |
GOFLAGS
is usedGOFLAGS
includes a tag for a different GOOS
I'm not sure that this is really a bug in (CC @matloob @timothy-king per https://dev.golang.org/owners) |
Ok that helps, thank you - This works as expected: Fyi I didn't have a specific reason to not use GOOS, I just copied it from #29202 (comment) Perhaps a warning could be displayed when tags are used that don't match the GOOS? |
@bcmills @powellnorma - I have encountered the same issue yesterday go vet -tags=linux # internal/goos
@matloob @timothy-king - I tried to run vet_test.go -> TestTags -> (c *Cmd) CombinedOutput() -> c.Stderr. is this stack data pushed into error? |
|
Thanks @timothy-king . I have done investigation and started a fix for that. It is not just for vet , impacts for build too. So testing more scenarios and here is the CL - https://go-review.googlesource.com/c/go/+/543675 |
Change https://go.dev/cl/543675 mentions this issue: |
Issue Description :
Uknown: This is pretty much possible for other Go variable which may need to be investigated. Impact: The same issue happens in go build process and leads to build failure. Fix Approaches:
|
I agree with @bcmills that this doesn't seem to be a bug. |
It is expected not to include both os files under internal/goos for windows and linux. But it does(Pls correct my understanding). This happens for go build too. @bcmills - your thoughts. |
@raghvenders, we do not expect Go users to set (There may be some tools — such as static analyzers — that set it explicitly in |
This is not a bug, and it is not about go vet. Using |
What version of Go are you using (
go version
)?Does this issue reproduce with the latest release?
Yes
What did you do?
main.go:
What did you expect to see?
The same output as before (when no
GOFLAGS
was used)The text was updated successfully, but these errors were encountered: