go-errorlint
go-errorlint copied to clipboard
Allow `%T` verb
when attempting to unmarshall json (or similar) into a type that implements error, we would like to print failures alongside the type that our unmarshalling failed against. an example in our codebase is here:
err = dec.Decode(&pErr)
if err != nil {
return nil, fmt.Errorf("%v is not a %T: %w", traceBody.String(), pErr, err)
}
this gets falsly flagged by this linter. the meanings and semantics of %T are significantly different from other verbs, and it should be ignored
Agreed. Thanks for raising this