Printf
-like function without f
suffix GO-W6006For Printf
-like functions they should be named correctly so that consumers of the function
use it correctly. It is recommended to use f
as suffix for such functions to make it clear
that arguments are preceded with format specifier.
func glog(format string, args ...any) {
log.Printf("glog " + format, args...)
}
func dump(w io.Writer, prefix, format string, args ...any) {
fmt.Fprintf(w, "dump " + format, args...)
}
func glogf(format string, args ...any) {
log.Printf("glog " + format, args...)
}
func dumpf(w io.Writer, prefix, format string, args ...any) {
fmt.Fprintf(w, "dump " + format, args...)
}