From 6a9ef3fa9a1579c6ed170db139f5629bde0ba04e Mon Sep 17 00:00:00 2001 From: yuzhiquan Date: Wed, 12 May 2021 15:42:21 +0800 Subject: [PATCH] fix typo comment should have function name as prefix fix potential nil pointer --- klog.go | 2 ++ klog_test.go | 2 +- klogr/klogr.go | 2 +- 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/klog.go b/klog.go index c0080c0b..1e187f76 100644 --- a/klog.go +++ b/klog.go @@ -284,6 +284,7 @@ func (m *moduleSpec) Get() interface{} { var errVmoduleSyntax = errors.New("syntax error: expect comma-separated list of filename=N") +// Set will sets module value // Syntax: -vmodule=recordio=2,file=1,gfs*=3 func (m *moduleSpec) Set(value string) error { var filter []modulePat @@ -362,6 +363,7 @@ func (t *traceLocation) Get() interface{} { var errTraceSyntax = errors.New("syntax error: expect file.go:234") +// Set will sets backtrace value // Syntax: -log_backtrace_at=gopherflakes.go:234 // Note that unlike vmodule the file extension is included here. func (t *traceLocation) Set(value string) error { diff --git a/klog_test.go b/klog_test.go index c0370c78..cd67e4c0 100644 --- a/klog_test.go +++ b/klog_test.go @@ -647,7 +647,7 @@ func BenchmarkLogs(b *testing.B) { testFile, err := ioutil.TempFile("", "test.log") if err != nil { - b.Error("unable to create temporary file") + b.Fatal("unable to create temporary file") } defer os.Remove(testFile.Name()) diff --git a/klogr/klogr.go b/klogr/klogr.go index afd478df..4cf80dd1 100644 --- a/klogr/klogr.go +++ b/klogr/klogr.go @@ -104,7 +104,7 @@ func framesToCaller() int { return 1 // something went wrong, this is safe } -// trimDuplicates will deduplicates elements provided in multiple KV tuple +// trimDuplicates will deduplicate elements provided in multiple KV tuple // slices, whilst maintaining the distinction between where the items are // contained. func trimDuplicates(kvLists ...[]interface{}) [][]interface{} {