cmd/vet: Avoid warning on pointer to invalid types.
TBR=r CC=golang-dev https://golang.org/cl/12038051
This commit is contained in:
parent
573374c476
commit
40baf75587
|
|
@ -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)
|
return t&argPointer != 0 || f.matchArgType(t, typ.Elem(), arg)
|
||||||
|
|
||||||
case *types.Pointer:
|
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
|
return t&argPointer != 0
|
||||||
|
|
||||||
case *types.Basic:
|
case *types.Basic:
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue