gogolint

golang compile time (static code analysis) to detect mismatch between formatting string and arguments


I recently discovered that I have a lot of logging messages that the formatting string and the arguments are not an exact match. It seems by default (I am using go 1.6) the compiler does not report such issues.

Can I activate such check for go compile time validation or any other static code analysis tool to detect a mismatch between formatting string and arguments?

Note golint does not seem to report such issues as well.


Solution

  • The vet command reports format string errors. The vet command is included in the Go 1.6 distribution.