-
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
cmd/vet,x/tools/go/analysis/passes/printf: broken with GODEBUG=gotypesalias=1 #68796
Comments
Change https://go.dev/cl/603938 mentions this issue: |
The maybePrintfWrapper function checks to see that a function has the form of a printf wrapper, but it wrongly assumed that the representation of the type of the "args ...any" parameter is exactly interface{}, not a named alias. This will not work with gotypesalias=1. Unfortunately our CL system failed to report this (or indeed any gotypesalias=1 coverage at all) because of a bug in the Go bootstrapping process that, in the absence of a go.work file (which sets the language version to go1.23), the default values of the GODEBUG table were based on an older version of Go. (The problem was only noticed when running a test of unitchecker locally in the context of issue 68796.) Also, the problem wasn't caught by our existing tests of the printf checker because they all pre-date "any", and so spelled it "interface{}". This CL will need to be vendored into the go1.23 release. Updates golang/go#68744 Updates golang/go#68796 Change-Id: I834ea20c2a684ffcd7ce9494d3700371ae6ab3c1 Reviewed-on: https://go-review.googlesource.com/c/tools/+/603938 Auto-Submit: Alan Donovan <adonovan@google.com> Reviewed-by: Robert Findley <rfindley@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Now that we understand it better, I don't think this needs to block the release. A missing vet diagnostic for printf wrappers (that use any, not interface{}) seems to be benign enough to fix in 1.23.1. |
Thanks. For this to be fixed in go1.23.1, it'll still need to be fixed at tip first and then backported, so moving this to Go1.24 milestone and re-adding release-blocker. Please use the usual process (https://go.dev/wiki/MinorReleases) to create a separate backport tracking issue in the Go1.23.1 milestone. |
@gopherbot please backport this issue to 1.23. It is a regression that may affect vet if #68797 is also backported. |
Backport issue(s) opened: #68813 (for 1.23). Remember to create the cherry-pick CL(s) as soon as the patch is submitted to master, according to https://go.dev/wiki/MinorReleases. |
To clarify: right now the version of vet distributed with go1.23rc2 DOES work as expected. It is only if we fix the incorrect GODEBUG value to have gotypesalias=1 that we would observe the printf bug, and even if that happened I don't think the nature of this bug is severe enough to block this release. I'm not even sure we should backport the fix to 1.23, unless we decide to also backport a fix for #68797. One of the motivations for marking this as a release blocker was that we weren't sure if GODEBUG was being set correctly during compilation of ALL programs. It turns out that the issue with GODEBUG is restricted to toolchain programs, as a result of the bootstrap process. That is a much smaller problem. |
Change https://go.dev/cl/609435 mentions this issue: |
…alias call The maybePrintfWrapper function checks to see that a function has the form of a printf wrapper, but it wrongly assumed that the representation of the type of the "args ...any" parameter is exactly interface{}, not a named alias. This will not work with gotypesalias=1. Unfortunately our CL system failed to report this (or indeed any gotypesalias=1 coverage at all) because of a bug in the Go bootstrapping process that, in the absence of a go.work file (which sets the language version to go1.23), the default values of the GODEBUG table were based on an older version of Go. (The problem was only noticed when running a test of unitchecker locally in the context of issue 68796.) Also, the problem wasn't caught by our existing tests of the printf checker because they all pre-date "any", and so spelled it "interface{}". This CL will need to be vendored into the go1.23 release. Updates golang/go#68744 Updates golang/go#68796 Change-Id: I834ea20c2a684ffcd7ce9494d3700371ae6ab3c1 Reviewed-on: https://go-review.googlesource.com/c/tools/+/603938 Auto-Submit: Alan Donovan <adonovan@google.com> Reviewed-by: Robert Findley <rfindley@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> (cherry picked from commit 28ba991) Reviewed-on: https://go-review.googlesource.com/c/tools/+/609435 TryBot-Bypass: Robert Findley <rfindley@google.com> Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
Checking on this issue as it's a release blocker for 1.24. Any updates? Thanks. |
Change https://go.dev/cl/610736 mentions this issue: |
Change https://go.dev/cl/610737 mentions this issue: |
Change https://go.dev/cl/610739 mentions this issue: |
These will cause build failures once we vendor x/tools. In once case I renamed a function err to errf to indicate that it is printf-like. Updates #68796 Change-Id: I04d57b34ee5362f530554b7e8b817f70a9088d12 Reviewed-on: https://go-review.googlesource.com/c/go/+/610739 Commit-Queue: Alan Donovan <adonovan@google.com> Reviewed-by: Robert Findley <rfindley@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Tim King <taking@google.com> Auto-Submit: Alan Donovan <adonovan@google.com>
Change https://go.dev/cl/610797 mentions this issue: |
These were problematic but previously easy to miss. They're now easy to spot thanks to build failures at Go tip as of CL 610736. For golang/go#68796. Change-Id: I167f2cce2376b4070460389c673d973e4521d3dc Reviewed-on: https://go-review.googlesource.com/c/crypto/+/610797 Auto-Submit: Dmitri Shuralyov <dmitshur@golang.org> Reviewed-by: Dmitri Shuralyov <dmitshur@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Alan Donovan <adonovan@google.com>
Repro, originating from @adonovan's investigation of #68744:
When GODEBUG=gotypesalias=1 (the default in 1.23), the printf analyzer fails to report a diagnostic for the
wrapf
printf wrapper, due to a missing call totypes.Unalias
.Separately, it appears the default vet tool distributed with 1.23rc2 (or built on the release branch with
make.bash
) does not have GODEBUG=gotypesalias=1. Otherwise, this should have been caught by the vet integration tests. I will file a separate issue for that.It may be the case that the two bugs mentioned in the previous two paragraphs effectively cancel themselves out for the Go distribution. However, I think we should at least block the release until we understand both better.
The text was updated successfully, but these errors were encountered: