lib/storage: typo fixes found by golangci-lint; updates https://github.com/VictoriaMetrics/VictoriaMetrics/issues/69

This commit is contained in:
Aliaksandr Valialkin 2019-06-20 14:37:46 +03:00
parent 7778030f9f
commit 9cac11db64
4 changed files with 3 additions and 10 deletions

View File

@ -261,7 +261,7 @@ func (db *indexDB) incRef() {
func (db *indexDB) decRef() {
n := atomic.AddUint64(&db.refCount, ^uint64(0))
if n < 0 {
if int64(n) < 0 {
logger.Panicf("BUG: negative refCount: %d", n)
}
if n > 0 {

View File

@ -620,13 +620,6 @@ func copyTags(dst, src []Tag) []Tag {
return dst
}
func (mn *MetricName) tagsLess(i, j int) bool {
a, b := mn.Tags[i].Key, mn.Tags[j].Key
a = normalizeTagKey(a)
b = normalizeTagKey(b)
return bytes.Compare(a, b) < 0
}
var commonTagKeys = func() map[string][]byte {
lcm := map[string][]byte{
// job-like tags must go first in MetricName.Tags.

View File

@ -50,7 +50,7 @@ func TestSearchQueryMarshalUnmarshal(t *testing.T) {
if sq1.MaxTimestamp != sq2.MaxTimestamp {
t.Fatalf("unexpected MaxTimestamp; got %d; want %d", sq2.MaxTimestamp, sq1.MaxTimestamp)
}
if len(sq1.TagFilterss) != len(sq1.TagFilterss) {
if len(sq1.TagFilterss) != len(sq2.TagFilterss) {
t.Fatalf("unexpected TagFilterss len; got %d; want %d", len(sq2.TagFilterss), len(sq1.TagFilterss))
}
for ii := range sq1.TagFilterss {

View File

@ -92,7 +92,7 @@ func createBenchTable(b *testing.B, path string, startTimestamp int64, rowsPerIn
r.Value = value
}
if err := tb.AddRows(rows); err != nil {
b.Fatalf("cannot add %d rows: %s", rowsPerInsert, err)
panic(fmt.Errorf("cannot add %d rows: %s", rowsPerInsert, err))
}
}
wg.Done()