如下的一段代码
func (t *BaseTable) DebugLogf(format string, v ...interface{}) {
g.Log().Warningf("%s", fmt.Sprintf(format, v))
}
执行golangci-lint run的提示,提示 printf missing ... in args forwarded to printf-like function (go vet);如下所示
发现是Sprintf方法里面,没有把接受到的可变参数传递进去,导致提示如上的错误。解决起来很简单,把代码修改如下即可:
g.Log().Warningf("%s", fmt.Sprintf(format, v...))