From ebf3cf8f7dca0f2885a2215510715a06a8ee69c8 Mon Sep 17 00:00:00 2001 From: Felix Lange Date: Fri, 15 Apr 2016 10:58:41 +0200 Subject: [PATCH] logger/glog: fix go vet issues logging.printf triggered a format string warning. Silence it by renaming the function. --- logger/glog/glog.go | 16 ++++++++-------- logger/glog/glog_test.go | 2 +- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/logger/glog/glog.go b/logger/glog/glog.go index 14e405955a..edaa21f075 100644 --- a/logger/glog/glog.go +++ b/logger/glog/glog.go @@ -698,7 +698,7 @@ func (l *loggingT) printDepth(s severity, depth int, args ...interface{}) { l.output(s, buf, file, line, false) } -func (l *loggingT) printf(s severity, format string, args ...interface{}) { +func (l *loggingT) printfmt(s severity, format string, args ...interface{}) { buf, file, line := l.header(s, 0) fmt.Fprintf(buf, format, args...) if buf.Bytes()[buf.Len()-1] != '\n' { @@ -1088,7 +1088,7 @@ func (v Verbose) Infoln(args ...interface{}) { // See the documentation of V for usage. func (v Verbose) Infof(format string, args ...interface{}) { if v { - logging.printf(infoLog, format, args...) + logging.printfmt(infoLog, format, args...) } } @@ -1107,13 +1107,13 @@ func InfoDepth(depth int, args ...interface{}) { // Infoln logs to the INFO log. // Arguments are handled in the manner of fmt.Println; a newline is appended if missing. func Infoln(args ...interface{}) { - logging.println(infoLog, args...) + logging.print(infoLog, args...) } // Infof logs to the INFO log. // Arguments are handled in the manner of fmt.Printf; a newline is appended if missing. func Infof(format string, args ...interface{}) { - logging.printf(infoLog, format, args...) + logging.printfmt(infoLog, format, args...) } // Warning logs to the WARNING and INFO logs. @@ -1137,7 +1137,7 @@ func Warningln(args ...interface{}) { // Warningf logs to the WARNING and INFO logs. // Arguments are handled in the manner of fmt.Printf; a newline is appended if missing. func Warningf(format string, args ...interface{}) { - logging.printf(warningLog, format, args...) + logging.printfmt(warningLog, format, args...) } // Error logs to the ERROR, WARNING, and INFO logs. @@ -1161,7 +1161,7 @@ func Errorln(args ...interface{}) { // Errorf logs to the ERROR, WARNING, and INFO logs. // Arguments are handled in the manner of fmt.Printf; a newline is appended if missing. func Errorf(format string, args ...interface{}) { - logging.printf(errorLog, format, args...) + logging.printfmt(errorLog, format, args...) } // Fatal logs to the FATAL, ERROR, WARNING, and INFO logs, @@ -1188,7 +1188,7 @@ func Fatalln(args ...interface{}) { // including a stack trace of all running goroutines, then calls os.Exit(255). // Arguments are handled in the manner of fmt.Printf; a newline is appended if missing. func Fatalf(format string, args ...interface{}) { - logging.printf(fatalLog, format, args...) + logging.printfmt(fatalLog, format, args...) } // fatalNoStacks is non-zero if we are to exit without dumping goroutine stacks. @@ -1219,5 +1219,5 @@ func Exitln(args ...interface{}) { // Arguments are handled in the manner of fmt.Printf; a newline is appended if missing. func Exitf(format string, args ...interface{}) { atomic.StoreUint32(&fatalNoStacks, 1) - logging.printf(fatalLog, format, args...) + logging.printfmt(fatalLog, format, args...) } diff --git a/logger/glog/glog_test.go b/logger/glog/glog_test.go index 30861a48d9..b58f3d6426 100644 --- a/logger/glog/glog_test.go +++ b/logger/glog/glog_test.go @@ -300,7 +300,7 @@ func TestCompileModulePattern(t *testing.T) { for _, test := range patternTests { re, err := compileModulePattern(test.input) if err != nil { - t.Fatalf("%s: %v", err) + t.Fatalf("%s: %v", test.input, err) } if re.String() != test.want { t.Errorf("mismatch for %q: got %q, want %q", test.input, re.String(), test.want)