Naming Printf-style Functions
When you declare a Printf
-style function, make sure that go vet
can detectit and check the format string.
This means that you should use pre-defined Printf
-style functionnames if possible. go vet
will check these by default. See Printf familyfor more information.
If using the pre-defined names is not an option, end the name you choose withf: Wrapf
, not Wrap
. go vet
can be asked to check specific Printf
-stylenames but they must end with f.
- $ go vet -printfuncs=wrapf,statusf
See also go vet: Printf family check.