1
0
mirror of https://github.com/golang/go synced 2024-11-18 16:54:43 -07:00

cmd/vet: Avoid warning on pointer to invalid types.

TBR=r
CC=golang-dev
https://golang.org/cl/12038051
This commit is contained in:
David Symonds 2013-07-30 13:41:07 +10:00
parent 573374c476
commit 40baf75587

View File

@ -113,6 +113,14 @@ func (f *File) matchArgType(t printfArgType, typ types.Type, arg ast.Expr) bool
return t&argPointer != 0 || f.matchArgType(t, typ.Elem(), arg)
case *types.Pointer:
// Ugly, but dealing with an edge case: a known pointer to an invalid type,
// probably something from a failed import.
if typ.Elem().String() == "invalid type" {
if *verbose {
f.Warnf(arg.Pos(), "printf argument %v is pointer to invalid or unknown type", f.gofmt(arg))
}
return true // special case
}
return t&argPointer != 0
case *types.Basic: