diff --git a/Makefile b/Makefile index a3e337978..e691d0f3c 100644 --- a/Makefile +++ b/Makefile @@ -123,6 +123,7 @@ gometalinter: require-gometalinter --enable=maligned \ --enable=misspell \ --enable=nakedret \ + --enable=unconvert \ --enable=unparam \ --enable=vet \ --exclude "^internal/.*\.pb\.go" \ diff --git a/boltdb/attrstore.go b/boltdb/attrstore.go index c6fa9bb76..339526478 100644 --- a/boltdb/attrstore.go +++ b/boltdb/attrstore.go @@ -262,8 +262,8 @@ func (s *attrStore) BlockData(i uint64) (map[uint64]map[string]interface{}, erro defer tx.Rollback() // Move to the start of the block. - min := u64tob(uint64(i) * attrBlockSize) - max := u64tob(uint64(i+1) * attrBlockSize) + min := u64tob(i * attrBlockSize) + max := u64tob((i + 1) * attrBlockSize) cur := tx.Bucket([]byte("attrs")).Cursor() for k, v := cur.Seek(min); k != nil; k, v = cur.Next() { // Exit if we're past the end of the block. diff --git a/cache.go b/cache.go index 044d85f3c..c6821c393 100644 --- a/cache.go +++ b/cache.go @@ -114,7 +114,7 @@ func (c *lruCache) Top() []bitmapPair { for id, n := range c.counts { a = append(a, bitmapPair{ ID: id, - Count: uint64(n), + Count: n, }) } sort.Sort(bitmapPairs(a)) diff --git a/field.go b/field.go index af18d8666..3b4cf857c 100644 --- a/field.go +++ b/field.go @@ -1072,9 +1072,9 @@ func (f *Field) importValue(columnIDs []uint64, values []int64) error { dataByFragment := make(map[importKey]importValueData) for i := range columnIDs { columnID, value := columnIDs[i], values[i] - if int64(value) > bsig.Max { + if value > bsig.Max { return fmt.Errorf("%v, columnID=%v, value=%v", ErrBSIGroupValueTooHigh, columnID, value) - } else if int64(value) < bsig.Min { + } else if value < bsig.Min { return fmt.Errorf("%v, columnID=%v, value=%v", ErrBSIGroupValueTooLow, columnID, value) } diff --git a/server/server.go b/server/server.go index 2433def7a..1273a238f 100644 --- a/server/server.go +++ b/server/server.go @@ -230,7 +230,7 @@ func (m *Command) SetupServer() error { diagnosticsInterval := time.Duration(0) if m.Config.Metric.Diagnostics { - diagnosticsInterval = time.Duration(defaultDiagnosticsInterval) + diagnosticsInterval = defaultDiagnosticsInterval } statsClient, err := newStatsClient(m.Config.Metric.Service, m.Config.Metric.Host) diff --git a/translate.go b/translate.go index 6b3c1856b..fd474cbb5 100644 --- a/translate.go +++ b/translate.go @@ -862,7 +862,7 @@ func (idx *index) lookupKey(offset int64) []byte { func (idx *index) alloc(capacity uint64) { idx.elems = make([]elem, capacity) idx.threshold = (capacity * uint64(idx.loadFactor)) / 100 - idx.mask = uint64(capacity - 1) + idx.mask = capacity - 1 } func (idx *index) dist(hash, i uint64) uint64 {