-
Notifications
You must be signed in to change notification settings - Fork 18k
x/tools/go/analysis/unitchecker: TestExampleSeparateAnalysis failing to produce printf diagnostics #68744
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
Found new dashboard test flakes for:
2024-08-05 17:36 x_tools-gotip-darwin-amd64-longtest tools@a5df6ad5 go@d465aee0 x/tools/go/analysis/unitchecker.TestVetStdlib (log)
2024-08-05 17:36 x_tools-gotip-linux-386-longtest tools@a5df6ad5 go@d465aee0 x/tools/go/analysis/unitchecker.TestVetStdlib (log)
2024-08-05 17:36 x_tools-gotip-linux-amd64-longtest tools@a5df6ad5 go@d465aee0 x/tools/go/analysis/unitchecker.TestVetStdlib (log)
2024-08-05 17:36 x_tools-gotip-linux-amd64-longtest-race tools@a5df6ad5 go@d465aee0 x/tools/go/analysis/unitchecker.TestVetStdlib (log)
2024-08-05 17:36 x_tools-gotip-linux-arm64-longtest tools@a5df6ad5 go@d465aee0 x/tools/go/analysis/unitchecker.TestVetStdlib (log)
2024-08-05 17:36 x_tools-gotip-windows-amd64-longtest tools@a5df6ad5 go@d465aee0 x/tools/go/analysis/unitchecker.TestVetStdlib (log)
2024-08-05 18:02 x_tools-gotip-darwin-amd64-longtest tools@3ffd605b go@d465aee0 x/tools/go/analysis/unitchecker.TestVetStdlib (log)
2024-08-05 18:02 x_tools-gotip-linux-386-longtest tools@3ffd605b go@d465aee0 x/tools/go/analysis/unitchecker.TestVetStdlib (log)
2024-08-05 18:02 x_tools-gotip-linux-amd64-longtest tools@3ffd605b go@d465aee0 x/tools/go/analysis/unitchecker.TestVetStdlib (log)
2024-08-05 18:02 x_tools-gotip-linux-amd64-longtest-race tools@3ffd605b go@d465aee0 x/tools/go/analysis/unitchecker.TestVetStdlib (log)
2024-08-05 18:02 x_tools-gotip-linux-arm64-longtest tools@3ffd605b go@d465aee0 x/tools/go/analysis/unitchecker.TestVetStdlib (log)
2024-08-05 18:02 x_tools-gotip-windows-amd64-longtest tools@3ffd605b go@d465aee0 x/tools/go/analysis/unitchecker.TestVetStdlib (log)
2024-08-05 18:50 x_tools-gotip-darwin-amd64-longtest tools@f855a539 go@1f0c044d x/tools/go/analysis/unitchecker.TestVetStdlib (log)
2024-08-05 18:50 x_tools-gotip-linux-386-longtest tools@f855a539 go@1f0c044d x/tools/go/analysis/unitchecker.TestVetStdlib (log)
2024-08-05 18:50 x_tools-gotip-linux-amd64-longtest tools@f855a539 go@1f0c044d x/tools/go/analysis/unitchecker.TestVetStdlib (log)
2024-08-05 18:50 x_tools-gotip-linux-amd64-longtest-race tools@f855a539 go@1f0c044d x/tools/go/analysis/unitchecker.TestVetStdlib (log)
2024-08-05 18:50 x_tools-gotip-linux-arm64-longtest tools@f855a539 go@1f0c044d x/tools/go/analysis/unitchecker.TestVetStdlib (log)
2024-08-05 18:50 x_tools-gotip-windows-amd64-longtest tools@f855a539 go@1f0c044d x/tools/go/analysis/unitchecker.TestVetStdlib (log)
2024-08-06 13:34 x_tools-gotip-darwin-amd64-longtest tools@4653e48e go@1f0c044d x/tools/go/analysis/unitchecker.TestVetStdlib (log)
2024-08-06 13:34 x_tools-gotip-linux-386-longtest tools@4653e48e go@1f0c044d x/tools/go/analysis/unitchecker.TestVetStdlib (log)
2024-08-06 13:34 x_tools-gotip-linux-amd64-longtest tools@4653e48e go@1f0c044d x/tools/go/analysis/unitchecker.TestVetStdlib (log)
2024-08-06 13:34 x_tools-gotip-linux-amd64-longtest-race tools@4653e48e go@1f0c044d x/tools/go/analysis/unitchecker.TestVetStdlib (log)
2024-08-06 13:34 x_tools-gotip-linux-arm64-longtest tools@4653e48e go@1f0c044d x/tools/go/analysis/unitchecker.TestVetStdlib (log)
2024-08-06 13:34 x_tools-gotip-windows-amd64-longtest tools@4653e48e go@1f0c044d x/tools/go/analysis/unitchecker.TestVetStdlib (log)
|
Found new dashboard test flakes for:
2024-08-06 13:34 x_tools-gotip-linux-386-longtest tools@4653e48e go@abc3d2c1 x/tools/go/analysis/unitchecker.TestVetStdlib (log)
2024-08-06 13:34 x_tools-gotip-linux-amd64-longtest tools@4653e48e go@abc3d2c1 x/tools/go/analysis/unitchecker.TestVetStdlib (log)
2024-08-06 13:34 x_tools-gotip-linux-amd64-longtest-race tools@4653e48e go@abc3d2c1 x/tools/go/analysis/unitchecker.TestVetStdlib (log)
2024-08-06 13:34 x_tools-gotip-linux-arm64-longtest tools@4653e48e go@abc3d2c1 x/tools/go/analysis/unitchecker.TestVetStdlib (log)
2024-08-06 13:34 x_tools-gotip-windows-amd64-longtest tools@4653e48e go@abc3d2c1 x/tools/go/analysis/unitchecker.TestVetStdlib (log)
|
Change https://go.dev/cl/603515 mentions this issue: |
Found new dashboard test flakes for:
2024-08-06 13:34 x_tools-gotip-darwin-amd64-longtest tools@4653e48e go@b915399e x/tools/go/analysis/unitchecker.TestVetStdlib (log)
|
Found new dashboard test flakes for:
2024-08-06 13:34 x_tools-gotip-darwin-amd64-longtest tools@4653e48e go@abc3d2c1 x/tools/go/analysis/unitchecker.TestVetStdlib (log)
|
Found new dashboard test flakes for:
2024-08-06 19:12 x_tools-gotip-darwin-amd64-longtest tools@3057be8f go@a7c7ec59 x/tools/go/analysis/unitchecker.TestVetStdlib (log)
|
Found new dashboard test flakes for:
2024-08-06 19:12 x_tools-gotip-darwin-amd64-longtest tools@3057be8f go@0ea534b8 x/tools/go/analysis/unitchecker.TestVetStdlib (log)
|
The original failure ("non-constant format string") was fixed by https://go.dev/cl/603515 (thanks @timothy-king), but I'm seeing a second failure with goroot and x/tools both at tip:
In other words, the separate-analysis test is failing to produce the expected printf diagnostics. Will investigate... |
Still investigating... |
Setting GOWORK=off within the test has no effect, so it's the effect of the go.work file on the build of the test executable that matters. Bisecting reveals that it's the So, the presence of a go.work file on a workstation (but not the builder) causes the tests to use go1.23 semantics, including language-version build tags, which may change the default value of a GODEBUG. This is working as intended. But gotypesalias=1 appears to have a bug that somehow affects this test. This bug may be a possible go1.23 release-blocker.
Thanks @matloob and @samthanawalla. |
Another lucky guess: this patch to go/types is an effective workaround. (The only alias I could see in the source was {
universeAnyNoAlias = NewTypeName(nopos, nil, "any", &Interface{complete: true, tset: &topTypeSet})
universeAnyNoAlias.setColor(black)
// ensure that the any TypeName reports a consistent Parent, after
// hijacking Universe.Lookup with gotypesalias=0.
universeAnyNoAlias.setParent(Universe)
// It shouldn't matter which representation of any is actually inserted
// into the Universe, but we lean toward the future and insert the Alias
// representation.
universeAnyAlias = NewTypeName(nopos, nil, "any", nil)
universeAnyAlias.setColor(black)
_ = NewAlias(universeAnyAlias, universeAnyNoAlias.Type().Underlying()) // Link TypeName and Alias
- def(universeAnyAlias)
+ def(universeAnyNoAlias)
} |
The problem is that the printf analyzer assumes that the type of the final --- a/go/analysis/passes/printf/printf.go
+++ b/go/analysis/passes/printf/printf.go
@@ -160,9 +160,8 @@ func maybePrintfWrapper(info *types.Info, decl ast.Decl) *printfWrapper {
nparams := params.Len() // variadic => nonzero
args := params.At(nparams - 1)
- iface, ok := args.Type().(*types.Slice).Elem().(*types.Interface)
- if !ok || !iface.Empty() {
- return nil // final (args) param is not ...interface{}
+ if !types.Identical(args.Type().(*types.Slice).Elem(), types.Universe.Lookup("any").Type()) {
+ return nil // final param (args) is not "...interface{}"
}
This somehow slipped through my audit for places that do |
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>
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>
Found new dashboard test flakes for:
2024-11-15 16:15 x_tools-gotip-linux-386-longtest tools@56ec1110 go@400433af x/tools/go/analysis/unitchecker.TestVetStdlib (log)
2024-11-15 16:15 x_tools-gotip-linux-amd64-longtest tools@56ec1110 go@400433af x/tools/go/analysis/unitchecker.TestVetStdlib (log)
2024-11-15 16:15 x_tools-gotip-linux-amd64-longtest-aliastypeparams tools@56ec1110 go@400433af x/tools/go/analysis/unitchecker.TestVetStdlib (log)
2024-11-15 16:15 x_tools-gotip-linux-amd64-longtest-race tools@56ec1110 go@400433af x/tools/go/analysis/unitchecker.TestVetStdlib (log)
2024-11-15 16:15 x_tools-gotip-linux-arm64-longtest tools@56ec1110 go@400433af x/tools/go/analysis/unitchecker.TestVetStdlib (log)
|
Found new dashboard test flakes for:
2024-11-15 16:15 x_tools-gotip-darwin-amd64-longtest tools@56ec1110 go@fd050b3c x/tools/go/analysis/unitchecker.TestVetStdlib (log)
2024-11-15 16:15 x_tools-gotip-windows-amd64-longtest tools@56ec1110 go@400433af x/tools/go/analysis/unitchecker.TestVetStdlib (log)
|
Most recent TestVetStdlib failures indicated a real problem, fixed by CL 628555. |
Issue created automatically to collect these failures.
Example (log):
— watchflakes
The text was updated successfully, but these errors were encountered: