mirror of
https://github.com/VictoriaMetrics/VictoriaMetrics.git
synced 2024-11-21 14:44:00 +00:00
Makefile: add -s flag to go fmt
in make fmt
command
This commit is contained in:
parent
024560b161
commit
d6523ffe90
3 changed files with 32 additions and 32 deletions
4
Makefile
4
Makefile
|
@ -27,8 +27,8 @@ release: victoria-metrics-prod
|
||||||
cd bin && tar czf victoria-metrics-$(PKG_TAG).tar.gz victoria-metrics-prod
|
cd bin && tar czf victoria-metrics-$(PKG_TAG).tar.gz victoria-metrics-prod
|
||||||
|
|
||||||
fmt:
|
fmt:
|
||||||
go fmt $(PKG_PREFIX)/lib/...
|
gofmt -l -w -s ./lib
|
||||||
go fmt $(PKG_PREFIX)/app/...
|
gofmt -l -w -s ./app
|
||||||
|
|
||||||
vet:
|
vet:
|
||||||
go vet $(PKG_PREFIX)/lib/...
|
go vet $(PKG_PREFIX)/lib/...
|
||||||
|
|
|
@ -39,7 +39,7 @@ func TestRollupResultCache(t *testing.T) {
|
||||||
t.Run("start-overlap", func(t *testing.T) {
|
t.Run("start-overlap", func(t *testing.T) {
|
||||||
ResetRollupResultCache()
|
ResetRollupResultCache()
|
||||||
tss := []*timeseries{
|
tss := []*timeseries{
|
||||||
×eries{
|
{
|
||||||
Timestamps: []int64{800, 1000, 1200},
|
Timestamps: []int64{800, 1000, 1200},
|
||||||
Values: []float64{0, 1, 2},
|
Values: []float64{0, 1, 2},
|
||||||
},
|
},
|
||||||
|
@ -50,7 +50,7 @@ func TestRollupResultCache(t *testing.T) {
|
||||||
t.Fatalf("unexpected newStart; got %d; want %d", newStart, 1400)
|
t.Fatalf("unexpected newStart; got %d; want %d", newStart, 1400)
|
||||||
}
|
}
|
||||||
tssExpected := []*timeseries{
|
tssExpected := []*timeseries{
|
||||||
×eries{
|
{
|
||||||
Timestamps: []int64{1000, 1200},
|
Timestamps: []int64{1000, 1200},
|
||||||
Values: []float64{1, 2},
|
Values: []float64{1, 2},
|
||||||
},
|
},
|
||||||
|
@ -62,7 +62,7 @@ func TestRollupResultCache(t *testing.T) {
|
||||||
t.Run("end-overlap", func(t *testing.T) {
|
t.Run("end-overlap", func(t *testing.T) {
|
||||||
ResetRollupResultCache()
|
ResetRollupResultCache()
|
||||||
tss := []*timeseries{
|
tss := []*timeseries{
|
||||||
×eries{
|
{
|
||||||
Timestamps: []int64{1800, 2000, 2200, 2400},
|
Timestamps: []int64{1800, 2000, 2200, 2400},
|
||||||
Values: []float64{333, 0, 1, 2},
|
Values: []float64{333, 0, 1, 2},
|
||||||
},
|
},
|
||||||
|
@ -81,7 +81,7 @@ func TestRollupResultCache(t *testing.T) {
|
||||||
t.Run("full-cover", func(t *testing.T) {
|
t.Run("full-cover", func(t *testing.T) {
|
||||||
ResetRollupResultCache()
|
ResetRollupResultCache()
|
||||||
tss := []*timeseries{
|
tss := []*timeseries{
|
||||||
×eries{
|
{
|
||||||
Timestamps: []int64{1200, 1400, 1600},
|
Timestamps: []int64{1200, 1400, 1600},
|
||||||
Values: []float64{0, 1, 2},
|
Values: []float64{0, 1, 2},
|
||||||
},
|
},
|
||||||
|
@ -100,7 +100,7 @@ func TestRollupResultCache(t *testing.T) {
|
||||||
t.Run("before-start", func(t *testing.T) {
|
t.Run("before-start", func(t *testing.T) {
|
||||||
ResetRollupResultCache()
|
ResetRollupResultCache()
|
||||||
tss := []*timeseries{
|
tss := []*timeseries{
|
||||||
×eries{
|
{
|
||||||
Timestamps: []int64{200, 400, 600},
|
Timestamps: []int64{200, 400, 600},
|
||||||
Values: []float64{0, 1, 2},
|
Values: []float64{0, 1, 2},
|
||||||
},
|
},
|
||||||
|
@ -119,7 +119,7 @@ func TestRollupResultCache(t *testing.T) {
|
||||||
t.Run("after-end", func(t *testing.T) {
|
t.Run("after-end", func(t *testing.T) {
|
||||||
ResetRollupResultCache()
|
ResetRollupResultCache()
|
||||||
tss := []*timeseries{
|
tss := []*timeseries{
|
||||||
×eries{
|
{
|
||||||
Timestamps: []int64{2200, 2400, 2600},
|
Timestamps: []int64{2200, 2400, 2600},
|
||||||
Values: []float64{0, 1, 2},
|
Values: []float64{0, 1, 2},
|
||||||
},
|
},
|
||||||
|
@ -138,7 +138,7 @@ func TestRollupResultCache(t *testing.T) {
|
||||||
t.Run("bigger-than-start-end", func(t *testing.T) {
|
t.Run("bigger-than-start-end", func(t *testing.T) {
|
||||||
ResetRollupResultCache()
|
ResetRollupResultCache()
|
||||||
tss := []*timeseries{
|
tss := []*timeseries{
|
||||||
×eries{
|
{
|
||||||
Timestamps: []int64{800, 1000, 1200, 1400, 1600, 1800, 2000, 2200},
|
Timestamps: []int64{800, 1000, 1200, 1400, 1600, 1800, 2000, 2200},
|
||||||
Values: []float64{0, 1, 2, 3, 4, 5, 6, 7},
|
Values: []float64{0, 1, 2, 3, 4, 5, 6, 7},
|
||||||
},
|
},
|
||||||
|
@ -149,7 +149,7 @@ func TestRollupResultCache(t *testing.T) {
|
||||||
t.Fatalf("unexpected newStart; got %d; want %d", newStart, 2200)
|
t.Fatalf("unexpected newStart; got %d; want %d", newStart, 2200)
|
||||||
}
|
}
|
||||||
tssExpected := []*timeseries{
|
tssExpected := []*timeseries{
|
||||||
×eries{
|
{
|
||||||
Timestamps: []int64{1000, 1200, 1400, 1600, 1800, 2000},
|
Timestamps: []int64{1000, 1200, 1400, 1600, 1800, 2000},
|
||||||
Values: []float64{1, 2, 3, 4, 5, 6},
|
Values: []float64{1, 2, 3, 4, 5, 6},
|
||||||
},
|
},
|
||||||
|
@ -161,7 +161,7 @@ func TestRollupResultCache(t *testing.T) {
|
||||||
t.Run("start-end-match", func(t *testing.T) {
|
t.Run("start-end-match", func(t *testing.T) {
|
||||||
ResetRollupResultCache()
|
ResetRollupResultCache()
|
||||||
tss := []*timeseries{
|
tss := []*timeseries{
|
||||||
×eries{
|
{
|
||||||
Timestamps: []int64{1000, 1200, 1400, 1600, 1800, 2000},
|
Timestamps: []int64{1000, 1200, 1400, 1600, 1800, 2000},
|
||||||
Values: []float64{1, 2, 3, 4, 5, 6},
|
Values: []float64{1, 2, 3, 4, 5, 6},
|
||||||
},
|
},
|
||||||
|
@ -172,7 +172,7 @@ func TestRollupResultCache(t *testing.T) {
|
||||||
t.Fatalf("unexpected newStart; got %d; want %d", newStart, 2200)
|
t.Fatalf("unexpected newStart; got %d; want %d", newStart, 2200)
|
||||||
}
|
}
|
||||||
tssExpected := []*timeseries{
|
tssExpected := []*timeseries{
|
||||||
×eries{
|
{
|
||||||
Timestamps: []int64{1000, 1200, 1400, 1600, 1800, 2000},
|
Timestamps: []int64{1000, 1200, 1400, 1600, 1800, 2000},
|
||||||
Values: []float64{1, 2, 3, 4, 5, 6},
|
Values: []float64{1, 2, 3, 4, 5, 6},
|
||||||
},
|
},
|
||||||
|
@ -203,19 +203,19 @@ func TestRollupResultCache(t *testing.T) {
|
||||||
t.Run("multi-timeseries", func(t *testing.T) {
|
t.Run("multi-timeseries", func(t *testing.T) {
|
||||||
ResetRollupResultCache()
|
ResetRollupResultCache()
|
||||||
tss1 := []*timeseries{
|
tss1 := []*timeseries{
|
||||||
×eries{
|
{
|
||||||
Timestamps: []int64{800, 1000, 1200},
|
Timestamps: []int64{800, 1000, 1200},
|
||||||
Values: []float64{0, 1, 2},
|
Values: []float64{0, 1, 2},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
tss2 := []*timeseries{
|
tss2 := []*timeseries{
|
||||||
×eries{
|
{
|
||||||
Timestamps: []int64{1800, 2000, 2200, 2400},
|
Timestamps: []int64{1800, 2000, 2200, 2400},
|
||||||
Values: []float64{333, 0, 1, 2},
|
Values: []float64{333, 0, 1, 2},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
tss3 := []*timeseries{
|
tss3 := []*timeseries{
|
||||||
×eries{
|
{
|
||||||
Timestamps: []int64{1200, 1400, 1600},
|
Timestamps: []int64{1200, 1400, 1600},
|
||||||
Values: []float64{0, 1, 2},
|
Values: []float64{0, 1, 2},
|
||||||
},
|
},
|
||||||
|
@ -228,7 +228,7 @@ func TestRollupResultCache(t *testing.T) {
|
||||||
t.Fatalf("unexpected newStart; got %d; want %d", newStart, 1400)
|
t.Fatalf("unexpected newStart; got %d; want %d", newStart, 1400)
|
||||||
}
|
}
|
||||||
tssExpected := []*timeseries{
|
tssExpected := []*timeseries{
|
||||||
×eries{
|
{
|
||||||
Timestamps: []int64{1000, 1200},
|
Timestamps: []int64{1000, 1200},
|
||||||
Values: []float64{1, 2},
|
Values: []float64{1, 2},
|
||||||
},
|
},
|
||||||
|
@ -249,14 +249,14 @@ func TestMergeTimeseries(t *testing.T) {
|
||||||
t.Run("bStart=ec.Start", func(t *testing.T) {
|
t.Run("bStart=ec.Start", func(t *testing.T) {
|
||||||
a := []*timeseries{}
|
a := []*timeseries{}
|
||||||
b := []*timeseries{
|
b := []*timeseries{
|
||||||
×eries{
|
{
|
||||||
Timestamps: []int64{1000, 1200, 1400, 1600, 1800, 2000},
|
Timestamps: []int64{1000, 1200, 1400, 1600, 1800, 2000},
|
||||||
Values: []float64{1, 2, 3, 4, 5, 6},
|
Values: []float64{1, 2, 3, 4, 5, 6},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
tss := mergeTimeseries(a, b, 1000, ec)
|
tss := mergeTimeseries(a, b, 1000, ec)
|
||||||
tssExpected := []*timeseries{
|
tssExpected := []*timeseries{
|
||||||
×eries{
|
{
|
||||||
Timestamps: []int64{1000, 1200, 1400, 1600, 1800, 2000},
|
Timestamps: []int64{1000, 1200, 1400, 1600, 1800, 2000},
|
||||||
Values: []float64{1, 2, 3, 4, 5, 6},
|
Values: []float64{1, 2, 3, 4, 5, 6},
|
||||||
},
|
},
|
||||||
|
@ -266,14 +266,14 @@ func TestMergeTimeseries(t *testing.T) {
|
||||||
t.Run("a-empty", func(t *testing.T) {
|
t.Run("a-empty", func(t *testing.T) {
|
||||||
a := []*timeseries{}
|
a := []*timeseries{}
|
||||||
b := []*timeseries{
|
b := []*timeseries{
|
||||||
×eries{
|
{
|
||||||
Timestamps: []int64{1400, 1600, 1800, 2000},
|
Timestamps: []int64{1400, 1600, 1800, 2000},
|
||||||
Values: []float64{3, 4, 5, 6},
|
Values: []float64{3, 4, 5, 6},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
tss := mergeTimeseries(a, b, bStart, ec)
|
tss := mergeTimeseries(a, b, bStart, ec)
|
||||||
tssExpected := []*timeseries{
|
tssExpected := []*timeseries{
|
||||||
×eries{
|
{
|
||||||
Timestamps: []int64{1000, 1200, 1400, 1600, 1800, 2000},
|
Timestamps: []int64{1000, 1200, 1400, 1600, 1800, 2000},
|
||||||
Values: []float64{nan, nan, 3, 4, 5, 6},
|
Values: []float64{nan, nan, 3, 4, 5, 6},
|
||||||
},
|
},
|
||||||
|
@ -282,7 +282,7 @@ func TestMergeTimeseries(t *testing.T) {
|
||||||
})
|
})
|
||||||
t.Run("b-empty", func(t *testing.T) {
|
t.Run("b-empty", func(t *testing.T) {
|
||||||
a := []*timeseries{
|
a := []*timeseries{
|
||||||
×eries{
|
{
|
||||||
Timestamps: []int64{1000, 1200},
|
Timestamps: []int64{1000, 1200},
|
||||||
Values: []float64{2, 1},
|
Values: []float64{2, 1},
|
||||||
},
|
},
|
||||||
|
@ -290,7 +290,7 @@ func TestMergeTimeseries(t *testing.T) {
|
||||||
b := []*timeseries{}
|
b := []*timeseries{}
|
||||||
tss := mergeTimeseries(a, b, bStart, ec)
|
tss := mergeTimeseries(a, b, bStart, ec)
|
||||||
tssExpected := []*timeseries{
|
tssExpected := []*timeseries{
|
||||||
×eries{
|
{
|
||||||
Timestamps: []int64{1000, 1200, 1400, 1600, 1800, 2000},
|
Timestamps: []int64{1000, 1200, 1400, 1600, 1800, 2000},
|
||||||
Values: []float64{2, 1, nan, nan, nan, nan},
|
Values: []float64{2, 1, nan, nan, nan, nan},
|
||||||
},
|
},
|
||||||
|
@ -299,20 +299,20 @@ func TestMergeTimeseries(t *testing.T) {
|
||||||
})
|
})
|
||||||
t.Run("non-empty", func(t *testing.T) {
|
t.Run("non-empty", func(t *testing.T) {
|
||||||
a := []*timeseries{
|
a := []*timeseries{
|
||||||
×eries{
|
{
|
||||||
Timestamps: []int64{1000, 1200},
|
Timestamps: []int64{1000, 1200},
|
||||||
Values: []float64{2, 1},
|
Values: []float64{2, 1},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
b := []*timeseries{
|
b := []*timeseries{
|
||||||
×eries{
|
{
|
||||||
Timestamps: []int64{1400, 1600, 1800, 2000},
|
Timestamps: []int64{1400, 1600, 1800, 2000},
|
||||||
Values: []float64{3, 4, 5, 6},
|
Values: []float64{3, 4, 5, 6},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
tss := mergeTimeseries(a, b, bStart, ec)
|
tss := mergeTimeseries(a, b, bStart, ec)
|
||||||
tssExpected := []*timeseries{
|
tssExpected := []*timeseries{
|
||||||
×eries{
|
{
|
||||||
Timestamps: []int64{1000, 1200, 1400, 1600, 1800, 2000},
|
Timestamps: []int64{1000, 1200, 1400, 1600, 1800, 2000},
|
||||||
Values: []float64{2, 1, 3, 4, 5, 6},
|
Values: []float64{2, 1, 3, 4, 5, 6},
|
||||||
},
|
},
|
||||||
|
@ -321,14 +321,14 @@ func TestMergeTimeseries(t *testing.T) {
|
||||||
})
|
})
|
||||||
t.Run("non-empty-distinct-metric-names", func(t *testing.T) {
|
t.Run("non-empty-distinct-metric-names", func(t *testing.T) {
|
||||||
a := []*timeseries{
|
a := []*timeseries{
|
||||||
×eries{
|
{
|
||||||
Timestamps: []int64{1000, 1200},
|
Timestamps: []int64{1000, 1200},
|
||||||
Values: []float64{2, 1},
|
Values: []float64{2, 1},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
a[0].MetricName.MetricGroup = []byte("bar")
|
a[0].MetricName.MetricGroup = []byte("bar")
|
||||||
b := []*timeseries{
|
b := []*timeseries{
|
||||||
×eries{
|
{
|
||||||
Timestamps: []int64{1400, 1600, 1800, 2000},
|
Timestamps: []int64{1400, 1600, 1800, 2000},
|
||||||
Values: []float64{3, 4, 5, 6},
|
Values: []float64{3, 4, 5, 6},
|
||||||
},
|
},
|
||||||
|
@ -336,14 +336,14 @@ func TestMergeTimeseries(t *testing.T) {
|
||||||
b[0].MetricName.MetricGroup = []byte("foo")
|
b[0].MetricName.MetricGroup = []byte("foo")
|
||||||
tss := mergeTimeseries(a, b, bStart, ec)
|
tss := mergeTimeseries(a, b, bStart, ec)
|
||||||
tssExpected := []*timeseries{
|
tssExpected := []*timeseries{
|
||||||
×eries{
|
{
|
||||||
MetricName: storage.MetricName{
|
MetricName: storage.MetricName{
|
||||||
MetricGroup: []byte("foo"),
|
MetricGroup: []byte("foo"),
|
||||||
},
|
},
|
||||||
Timestamps: []int64{1000, 1200, 1400, 1600, 1800, 2000},
|
Timestamps: []int64{1000, 1200, 1400, 1600, 1800, 2000},
|
||||||
Values: []float64{nan, nan, 3, 4, 5, 6},
|
Values: []float64{nan, nan, 3, 4, 5, 6},
|
||||||
},
|
},
|
||||||
×eries{
|
{
|
||||||
MetricName: storage.MetricName{
|
MetricName: storage.MetricName{
|
||||||
MetricGroup: []byte("bar"),
|
MetricGroup: []byte("bar"),
|
||||||
},
|
},
|
||||||
|
|
|
@ -112,15 +112,15 @@ func testAppendPartsToMerge(t *testing.T, maxPartsToMerge int, initialRowsCount,
|
||||||
|
|
||||||
// Verify appending to prefix
|
// Verify appending to prefix
|
||||||
prefix := []*partWrapper{
|
prefix := []*partWrapper{
|
||||||
&partWrapper{
|
{
|
||||||
p: &part{
|
p: &part{
|
||||||
ph: partHeader{
|
ph: partHeader{
|
||||||
RowsCount: 1234,
|
RowsCount: 1234,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
&partWrapper{},
|
{},
|
||||||
&partWrapper{},
|
{},
|
||||||
}
|
}
|
||||||
pms = appendPartsToMerge(prefix, pws, maxPartsToMerge, 1e9)
|
pms = appendPartsToMerge(prefix, pws, maxPartsToMerge, 1e9)
|
||||||
if !reflect.DeepEqual(pms[:len(prefix)], prefix) {
|
if !reflect.DeepEqual(pms[:len(prefix)], prefix) {
|
||||||
|
|
Loading…
Reference in a new issue