Fix linter issues: ineffassign

This commit is contained in:
Cody Soyland 2018-07-18 14:02:56 -05:00
parent cceb1ebdf6
commit d4510172d3
7 changed files with 20 additions and 3 deletions

View file

@ -117,6 +117,7 @@ gometalinter: require-gometalinter
--enable=goimports \
--enable=gotype \
--enable=gotypex \
--enable=ineffassign \
--enable=interfacer \
--enable=misspell \
--enable=unparam \

View file

@ -203,6 +203,9 @@ func TestImportCommand_BugOverwriteValue(t *testing.T) {
file.Close()
file, err = ioutil.TempFile("", "import-value2.csv")
if err != nil {
t.Fatalf("Error creating tempfile: %s", err)
}
file.Write([]byte("0,16\n"))
cm.Paths = []string{file.Name()}
err = cm.Run(ctx)
@ -212,6 +215,9 @@ func TestImportCommand_BugOverwriteValue(t *testing.T) {
file.Close()
file, err = ioutil.TempFile("", "import-value3.csv")
if err != nil {
t.Fatalf("Error creating tempfile: %s", err)
}
file.Write([]byte("0,19\n"))
cm.Paths = []string{file.Name()}
err = cm.Run(ctx)

View file

@ -31,6 +31,9 @@ func TestInspectCommand_Run(t *testing.T) {
cm := NewInspectCommand(stdin, w, w)
file, err := ioutil.TempFile("", "inspectTest")
if err != nil {
t.Fatalf("Error creating tempfile: %s", err)
}
file.Write([]byte("12358267538963"))
file.Close()
cm.Path = file.Name()

View file

@ -584,9 +584,9 @@ func (f *fragment) sum(filter *Row, bitDepth uint) (sum, count uint64, err error
//
// 10*(2^0) + 4*(2^1) + 3*(2^2) = 30
//
var cnt uint64
for i := uint(0); i < bitDepth; i++ {
row := f.row(uint64(i))
cnt := uint64(0)
if filter != nil {
cnt = row.intersectionCount(filter)
} else {
@ -1713,10 +1713,11 @@ func (f *fragment) rows() []uint64 {
}
func (f *fragment) rowsForColumn(columnID uint64) []uint64 {
var colKey uint64
colID := columnID % ShardWidth
i, _ := f.storage.Containers.Iterator(0)
colKey := uint64(0)
colVal := uint16(colID & 0xFFFF)
rows := make([]uint64, 0)

View file

@ -2276,7 +2276,7 @@ func TestIteratorRuns(t *testing.T) {
t.Fatalf("iterator did not seek correctly in multiple containers: %v\n", itr)
}
val, eof = itr.Next()
itr.Next()
val, eof = itr.Next()
if !(val == 0 && eof) {
t.Fatalf("iterator did not eof correctly: %d, %v\n", val, eof)

View file

@ -243,6 +243,9 @@ func MustDo(method, urlStr string, body string) *httpResponse {
urlStr,
strings.NewReader(body),
)
if err != nil {
panic(err)
}
req.Header.Set("Content-Type", "application/json")
req.Header.Set("Accept", "application/json")

View file

@ -40,6 +40,9 @@ func TestNewCluster(t *testing.T) {
cluster[0].URL()+"/status",
strings.NewReader(""),
)
if err != nil {
t.Fatalf("creating http request: %v", err)
}
req.Header.Set("Accept", "application/json")