]> Cypherpunks repositories - gostls13.git/commitdiff
vet: add regression test for printf checker regression
authorAlan Donovan <adonovan@google.com>
Wed, 4 Sep 2024 16:30:47 +0000 (12:30 -0400)
committerGopher Robot <gobot@golang.org>
Wed, 12 Feb 2025 19:18:11 +0000 (11:18 -0800)
Updates golang/go#68796

Change-Id: I5bfa80216deff76fd9aabe9882f93fbfaebef957
Reviewed-on: https://go-review.googlesource.com/c/go/+/610737
Auto-Submit: Alan Donovan <adonovan@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Michael Matloob <matloob@golang.org>
src/cmd/vet/testdata/print/print.go

index fffe571163889f584bd340a3655bd40aa90ce9d3..e00222c42b5aefb1656c3f046d9dfd5c57742d35 100644 (file)
@@ -678,3 +678,12 @@ func PointersToCompoundTypes() {
        }
        fmt.Printf("%s\n", T1{&T2{"x"}}) // ERROR "Printf format %s has arg T1{&T2{.x.}} of wrong type .*print\.T1"
 }
+
+// Regression test for #68796: materialized aliases cause printf
+// checker not to recognize "any" as identical to "interface{}".
+func printfUsingAnyNotEmptyInterface(format string, args ...any) {
+       _ = fmt.Sprintf(format, args...)
+}
+func _() {
+       printfUsingAnyNotEmptyInterface("%s", 123) // ERROR "wrong type"
+}