From: Alan Donovan Date: Wed, 4 Sep 2024 16:30:47 +0000 (-0400) Subject: vet: add regression test for printf checker regression X-Git-Tag: go1.25rc1~1063 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=6519aa955dd765072ac25881b127796d43de2b9a;p=gostls13.git vet: add regression test for printf checker regression Updates golang/go#68796 Change-Id: I5bfa80216deff76fd9aabe9882f93fbfaebef957 Reviewed-on: https://go-review.googlesource.com/c/go/+/610737 Auto-Submit: Alan Donovan LUCI-TryBot-Result: Go LUCI Reviewed-by: Michael Matloob --- diff --git a/src/cmd/vet/testdata/print/print.go b/src/cmd/vet/testdata/print/print.go index fffe571163..e00222c42b 100644 --- a/src/cmd/vet/testdata/print/print.go +++ b/src/cmd/vet/testdata/print/print.go @@ -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" +}