diff options
author | Felix Lange <fjl@twurst.com> | 2017-03-23 22:48:30 +0800 |
---|---|---|
committer | Felix Lange <fjl@twurst.com> | 2017-03-24 17:28:46 +0800 |
commit | df1fbe3c067bbca9be10f6fc2d09a66f82313a82 (patch) | |
tree | d4ad087122f49310c0c9ddeb5b0cf6a9d50c020e /log/handler.go | |
parent | e7911ad9ea38eaf8707b7247a5ac96bc81de856c (diff) | |
download | go-tangerine-df1fbe3c067bbca9be10f6fc2d09a66f82313a82.tar go-tangerine-df1fbe3c067bbca9be10f6fc2d09a66f82313a82.tar.gz go-tangerine-df1fbe3c067bbca9be10f6fc2d09a66f82313a82.tar.bz2 go-tangerine-df1fbe3c067bbca9be10f6fc2d09a66f82313a82.tar.lz go-tangerine-df1fbe3c067bbca9be10f6fc2d09a66f82313a82.tar.xz go-tangerine-df1fbe3c067bbca9be10f6fc2d09a66f82313a82.tar.zst go-tangerine-df1fbe3c067bbca9be10f6fc2d09a66f82313a82.zip |
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.
Diffstat (limited to 'log/handler.go')
-rw-r--r-- | log/handler.go | 7 |
1 files changed, 6 insertions, 1 deletions
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. |