From 09142e4dd19564cea35d5cee25230137f2cf84ba Mon Sep 17 00:00:00 2001 From: Mario Trangoni Date: Wed, 21 Mar 2018 21:23:47 +0100 Subject: [PATCH] fix unconvert issues: unnecessary conversion --- chunkenc/xor.go | 2 +- chunks/chunks.go | 2 +- db.go | 2 +- index/index.go | 8 ++++---- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/chunkenc/xor.go b/chunkenc/xor.go index ff690f222..0f14cf720 100644 --- a/chunkenc/xor.go +++ b/chunkenc/xor.go @@ -259,7 +259,7 @@ func (it *xorIterator) Next() bool { it.err = err return false } - it.t = int64(t) + it.t = t it.val = math.Float64frombits(v) it.numRead++ diff --git a/chunks/chunks.go b/chunks/chunks.go index e32ea0f99..fa2bf3b4e 100644 --- a/chunks/chunks.go +++ b/chunks/chunks.go @@ -349,7 +349,7 @@ func (s *Reader) Chunk(ref uint64) (chunkenc.Chunk, error) { } b := s.bs[seq] - if int(off) >= b.Len() { + if off >= b.Len() { return nil, errors.Errorf("offset %d beyond data size %d", off, b.Len()) } // With the minimum chunk length this should never cause us reading diff --git a/db.go b/db.go index 489f3a12e..8328355ea 100644 --- a/db.go +++ b/db.go @@ -737,7 +737,7 @@ func (db *DB) CleanTombstones() error { defer db.cmtx.Unlock() start := time.Now() - defer db.metrics.tombCleanTimer.Observe(float64(time.Since(start).Seconds())) + defer db.metrics.tombCleanTimer.Observe(time.Since(start).Seconds()) db.mtx.RLock() blocks := db.blocks[:] diff --git a/index/index.go b/index/index.go index 3cad716c0..72ca3835a 100644 --- a/index/index.go +++ b/index/index.go @@ -780,7 +780,7 @@ func (r *Reader) readSymbols(off int) error { for d.err() == nil && d.len() > 0 && cnt > 0 { s := d.uvarintStr() - r.symbols[uint32(nextPos)] = s + r.symbols[nextPos] = s if r.version == 2 { nextPos++ @@ -800,7 +800,7 @@ func (r *Reader) readOffsetTable(off uint64, f func([]string, uint64) error) err cnt := d.be32() for d.err() == nil && d.len() > 0 && cnt > 0 { - keyCount := int(d.uvarint()) + keyCount := d.uvarint() keys := make([]string, 0, keyCount) for i := 0; i < keyCount; i++ { @@ -1038,7 +1038,7 @@ func (dec *Decoder) Series(b []byte, lbls *labels.Labels, chks *[]chunks.Meta) e d := decbuf{b: b} - k := int(d.uvarint()) + k := d.uvarint() for i := 0; i < k; i++ { lno := uint32(d.uvarint()) @@ -1061,7 +1061,7 @@ func (dec *Decoder) Series(b []byte, lbls *labels.Labels, chks *[]chunks.Meta) e } // Read the chunks meta data. - k = int(d.uvarint()) + k = d.uvarint() if k == 0 { return nil