From df1fbe3c067bbca9be10f6fc2d09a66f82313a82 Mon Sep 17 00:00:00 2001 From: Felix Lange Date: Thu, 23 Mar 2017 15:48:30 +0100 Subject: build: always run go vet This ensures 'make test' finds all errors that remote CI would find. Go 1.7 vet reports a false positive in package log, add a workaround. --- log/handler.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'log') diff --git a/log/handler.go b/log/handler.go index abb17b4c4..d5594b853 100644 --- a/log/handler.go +++ b/log/handler.go @@ -106,11 +106,16 @@ func CallerFileHandler(h Handler) Handler { // the context with key "fn". func CallerFuncHandler(h Handler) Handler { return FuncHandler(func(r *Record) error { - r.Ctx = append(r.Ctx, "fn", fmt.Sprintf("%+n", r.Call)) + r.Ctx = append(r.Ctx, "fn", formatCall("%+n", r.Call)) return h.Log(r) }) } +// This function is here to please go vet on Go < 1.8. +func formatCall(format string, c stack.Call) string { + return fmt.Sprintf(format, c) +} + // CallerStackHandler returns a Handler that adds a stack trace to the context // with key "stack". The stack trace is formated as a space separated list of // call sites inside matching []'s. The most recent call site is listed first. -- cgit v1.2.3