cmd/vet: flag likely incorrect %T usages on reflect.Type #41590
Labels
Analysis
Issues related to static analysis (vet, x/tools/go/analysis)
FeatureRequest
Issues asking for a new feature that does not need a proposal.
NeedsInvestigation
Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Milestone
In code that uses Go reflection, it is common that the user prints the type. However, it easy for people (out of habit) to use %T with a
reflect.Type
when they should actually be using%v
instead.For example:
It is unlikely that the wrong verb is detected during code review.
In the instances similar to this, I don't think I saw a single case where a person actually wanted to print the type of
reflect.Type
itself (which by the way is*reflect.rtype
and not particularly interesting for users).\cc @dominikh in case this is a check better suited for
staticcheck
than vet.The text was updated successfully, but these errors were encountered: