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: Builds using go1.16.x report an ambiguous error when an imported dependency contains '//go:build' but not '// +build' #51436
Comments
I'd like to figure out whether this also affects Go at tip (perhaps in a different form). If it doesn't, then this probably isn't worth fixing (since Go 1.16 is EOL in about a month), but the root cause may point to a similar or different symptom of a problem that still exists. |
Agreed. I don't think it needs to be addressed for 1.16.x given that 1.18 is due to be released presently (rc1 is available as I post this), but the abstract issue of the error not showing the "correct" source/line info is valid and should be addressed if possible. |
I suspect that there may still be some related bugs in how we attribute errors for various failure modes, but it's been long enough that I don't expect to be able to chase this one down based on the original reproducer. 😞 I'm definitely still interested in fixing these bugs, but I'm going to close this particular issue as “probably not a productive avenue of investigation any more”. |
Change https://go.dev/cl/448996 mentions this issue: |
Change https://go.dev/cl/449175 mentions this issue: |
When a project transitively depends on x/vuln/internal, go1.16 is confused and fails with errors like "//go:build comment without // +build comment" Even when conditionally import x/vuln/internal only for go1.18+, this error is unavoidable. Let's wait a bit longer and help users who are stuck with old go. Updates golang/go#51436 Change-Id: I22fce4c037bef3621800a7cca31d31938025078a Reviewed-on: https://go-review.googlesource.com/c/vuln/+/449175 TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Bryan Mills <bcmills@google.com> Run-TryBot: Hyang-Ah Hana Kim <hyangah@gmail.com>
When a project transitively depends on x/exp/slices, go1.16 is confused and fails with errors like: "//go:build comment without // +build comment" Even when import of x/exp/slices guarded with build tags, so this is imported only when compiling with go1.18, this error is unavoidable. Let's wait a bit longer and help users who are stuck with old go. Updates golang/go#51436 Change-Id: I7ba589644475f55585c11ba1f7650c5ede6bc637 Reviewed-on: https://go-review.googlesource.com/c/exp/+/448996 TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Bryan Mills <bcmills@google.com> Run-TryBot: Hyang-Ah Hana Kim <hyangah@gmail.com>
Go 1.16 has a bug that causes build failure (ex: https://github.com/goto/meteor/actions/runs/4434675833/jobs/7780899433#step:4:435). Go issue - golang/go#51436
Go 1.16 has a bug that causes build failure (ex: https://github.com/goto/meteor/actions/runs/4434675833/jobs/7780899433#step:4:435). Go issue - golang/go#51436
Go 1.16 has a bug that causes build failure (ex: https://github.com/goto/meteor/actions/runs/4434675833/jobs/7780899433#step:4:435). Go issue - golang/go#51436
- Upgrade Go version to 1.20. Go 1.16 has a bug that causes build failure (ex: https://github.com/goto/meteor/actions/runs/4434675833/jobs/7780899433#step:4:435). Go issue - golang/go#51436
When a project transitively depends on x/vuln/internal, go1.16 is confused and fails with errors like "//go:build comment without // +build comment" Even when conditionally import x/vuln/internal only for go1.18+, this error is unavoidable. Let's wait a bit longer and help users who are stuck with old go. Updates golang/go#51436 Change-Id: I22fce4c037bef3621800a7cca31d31938025078a Reviewed-on: https://go-review.googlesource.com/c/vuln/+/449175 TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Bryan Mills <bcmills@google.com> Run-TryBot: Hyang-Ah Hana Kim <hyangah@gmail.com>
When a project transitively depends on x/vuln/internal, go1.16 is confused and fails with errors like "//go:build comment without // +build comment" Even when conditionally import x/vuln/internal only for go1.18+, this error is unavoidable. Let's wait a bit longer and help users who are stuck with old go. Updates golang/go#51436 Change-Id: I22fce4c037bef3621800a7cca31d31938025078a Reviewed-on: https://go-review.googlesource.com/c/vuln/+/449175 TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Bryan Mills <bcmills@google.com> Run-TryBot: Hyang-Ah Hana Kim <hyangah@gmail.com>
When a project transitively depends on x/vuln/internal, go1.16 is confused and fails with errors like "//go:build comment without // +build comment" Even when conditionally import x/vuln/internal only for go1.18+, this error is unavoidable. Let's wait a bit longer and help users who are stuck with old go. Updates golang/go#51436 Change-Id: I22fce4c037bef3621800a7cca31d31938025078a Reviewed-on: https://go-review.googlesource.com/c/vuln/+/449175 TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Bryan Mills <bcmills@google.com> Run-TryBot: Hyang-Ah Hana Kim <hyangah@gmail.com>
What version of Go are you using (
go version
)?Does this issue reproduce with the latest release?
No. Both go1.17 and go1.18rc1 work correctly.
What operating system and processor architecture are you using (
go env
)?go env
OutputWhat did you do?
Several of our internal modules at work have recently started failing to build with an error that says nothing more than
//go:build comment without // +build comment
. We were able to determine that the error only happens for things that are still on Go 1.16.x and upgrading them to 1.17 made the error go away.Further digging revealed that the actual problem was within the bitbucket.org/bertimus9/systemstat module, which removed
// +build
directive comments with this commit, purportedly to "update to play nice with go 1.17".The snippet below is a minimal reproducible example (included here because go.dev/play doesn't seem to have an option to use go1.16.x):
Attempting to build the code above generates the following error when using Go 1.16.x:
The behavior is correct according to this proposal, but the error message gives no indication that the missing
// +build
directive inside of a dependency. Instead it shows the source/line information for the import of the "bad" package.What did you expect to see?
An error with the source/line information pointing to the dependency's code, where the problem actually exists.
What did you see instead?
An error with the source/line information pointing at my own code with no explanation that the issue actually exists elsewhere.
The text was updated successfully, but these errors were encountered: