From 3c57c24921f8197343cf6e592de31b5fd31509cc Mon Sep 17 00:00:00 2001 From: Zach Ramsay Date: Fri, 22 Sep 2017 12:14:27 -0400 Subject: [PATCH] linting: next round of fixes --- Makefile | 1 - autofile/group.go | 4 ++-- autofile/group_test.go | 8 +++----- common/service.go | 2 +- db/c_level_db_test.go | 2 +- db/go_level_db_test.go | 2 +- pubsub/query/query.peg.go | 4 +--- 7 files changed, 9 insertions(+), 14 deletions(-) diff --git a/Makefile b/Makefile index ba164ec1d..6b2c7463a 100644 --- a/Makefile +++ b/Makefile @@ -45,7 +45,6 @@ metalinter_test: ensure_tools --enable=varcheck \ --enable=vetshadow \ --enable=interfacer \ - --enable=unparam \ --enable=vet \ ./... diff --git a/autofile/group.go b/autofile/group.go index 689b1cb92..eedb67b50 100644 --- a/autofile/group.go +++ b/autofile/group.go @@ -567,8 +567,8 @@ func (gr *GroupReader) ReadLine() (string, error) { bytesRead, err := gr.curReader.ReadBytes('\n') if err == io.EOF { // Open the next file - if err := gr.openFile(gr.curIndex + 1); err != nil { - return "", err + if err1 := gr.openFile(gr.curIndex + 1); err1 != nil { + return "", err1 } if len(bytesRead) > 0 && bytesRead[len(bytesRead)-1] == byte('\n') { return linePrefix + string(bytesRead[:len(bytesRead)-1]), nil diff --git a/autofile/group_test.go b/autofile/group_test.go index 91c6a0bbd..0cfcef72f 100644 --- a/autofile/group_test.go +++ b/autofile/group_test.go @@ -77,8 +77,7 @@ func TestCheckHeadSizeLimit(t *testing.T) { assertGroupInfo(t, g.ReadGroupInfo(), 0, 0, 999000, 999000) // Write 1000 more bytes. - err := g.WriteLine(RandStr(999)) - if err != nil { + if err := g.WriteLine(RandStr(999)); err != nil { t.Fatal("Error appending to head", err) } g.Flush() @@ -88,8 +87,7 @@ func TestCheckHeadSizeLimit(t *testing.T) { assertGroupInfo(t, g.ReadGroupInfo(), 0, 1, 1000000, 0) // Write 1000 more bytes. - err = g.WriteLine(RandStr(999)) - if err != nil { + if err := g.WriteLine(RandStr(999)); err != nil { t.Fatal("Error appending to head", err) } g.Flush() @@ -112,7 +110,7 @@ func TestCheckHeadSizeLimit(t *testing.T) { assertGroupInfo(t, g.ReadGroupInfo(), 0, 2, 2000000, 0) // Write 1000 more bytes. - _, err = g.Head.Write([]byte(RandStr(999) + "\n")) + _, err := g.Head.Write([]byte(RandStr(999) + "\n")) if err != nil { t.Fatal("Error appending to head", err) } diff --git a/common/service.go b/common/service.go index 71fc03cb9..5ac386316 100644 --- a/common/service.go +++ b/common/service.go @@ -151,7 +151,7 @@ func (bs *BaseService) Reset() (bool, error) { return false, nil } // never happens - return false, nil + return false, nil // nolint: vet } // Implements Service diff --git a/db/c_level_db_test.go b/db/c_level_db_test.go index 0ee6d6414..e7336cc5f 100644 --- a/db/c_level_db_test.go +++ b/db/c_level_db_test.go @@ -50,7 +50,7 @@ func BenchmarkRandomReadsWrites2(b *testing.B) { //fmt.Printf("Get %X -> %X\n", idxBytes, valBytes) if val == 0 { if !bytes.Equal(valBytes, nil) { - b.Errorf("Expected %X for %v, got %X", + b.Errorf("Expected %v for %v, got %X", nil, idx, valBytes) break } diff --git a/db/go_level_db_test.go b/db/go_level_db_test.go index 0603b2d4f..2cd3192c3 100644 --- a/db/go_level_db_test.go +++ b/db/go_level_db_test.go @@ -49,7 +49,7 @@ func BenchmarkRandomReadsWrites(b *testing.B) { //fmt.Printf("Get %X -> %X\n", idxBytes, valBytes) if val == 0 { if !bytes.Equal(valBytes, nil) { - b.Errorf("Expected %X for %v, got %X", + b.Errorf("Expected %v for %v, got %X", nil, idx, valBytes) break } diff --git a/pubsub/query/query.peg.go b/pubsub/query/query.peg.go index 8c3e83efc..c86e4a47f 100644 --- a/pubsub/query/query.peg.go +++ b/pubsub/query/query.peg.go @@ -1,6 +1,4 @@ -// nolint: megacheck -// nolint: varcheck -// nolint: deadcode +// nolint package query import (