Browse Source

linting: next round of fixes

pull/1842/head
Zach Ramsay 7 years ago
parent
commit
3c57c24921
7 changed files with 9 additions and 14 deletions
  1. +0
    -1
      Makefile
  2. +2
    -2
      autofile/group.go
  3. +3
    -5
      autofile/group_test.go
  4. +1
    -1
      common/service.go
  5. +1
    -1
      db/c_level_db_test.go
  6. +1
    -1
      db/go_level_db_test.go
  7. +1
    -3
      pubsub/query/query.peg.go

+ 0
- 1
Makefile View File

@ -45,7 +45,6 @@ metalinter_test: ensure_tools
--enable=varcheck \
--enable=vetshadow \
--enable=interfacer \
--enable=unparam \
--enable=vet \
./...


+ 2
- 2
autofile/group.go View File

@ -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


+ 3
- 5
autofile/group_test.go View File

@ -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)
}


+ 1
- 1
common/service.go View File

@ -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


+ 1
- 1
db/c_level_db_test.go View File

@ -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
}


+ 1
- 1
db/go_level_db_test.go View File

@ -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
}


+ 1
- 3
pubsub/query/query.peg.go View File

@ -1,6 +1,4 @@
// nolint: megacheck
// nolint: varcheck
// nolint: deadcode
// nolint
package query
import (


Loading…
Cancel
Save