Upgrade to golangci-lint v2 (#1008)
This commit is contained in:
@@ -12,7 +12,7 @@ import (
|
||||
"github.com/pelletier/go-toml/v2/internal/assert"
|
||||
)
|
||||
|
||||
var bench_inputs = []struct {
|
||||
var benchInputs = []struct {
|
||||
name string
|
||||
jsonLen int
|
||||
}{
|
||||
@@ -30,7 +30,7 @@ var bench_inputs = []struct {
|
||||
}
|
||||
|
||||
func TestUnmarshalDatasetCode(t *testing.T) {
|
||||
for _, tc := range bench_inputs {
|
||||
for _, tc := range benchInputs {
|
||||
t.Run(tc.name, func(t *testing.T) {
|
||||
buf := fixture(t, tc.name)
|
||||
|
||||
@@ -45,7 +45,7 @@ func TestUnmarshalDatasetCode(t *testing.T) {
|
||||
}
|
||||
|
||||
func BenchmarkUnmarshalDataset(b *testing.B) {
|
||||
for _, tc := range bench_inputs {
|
||||
for _, tc := range benchInputs {
|
||||
b.Run(tc.name, func(b *testing.B) {
|
||||
buf := fixture(b, tc.name)
|
||||
b.SetBytes(int64(len(buf)))
|
||||
@@ -69,7 +69,7 @@ func fixture(tb testing.TB, path string) []byte {
|
||||
tb.Skip("benchmark fixture not found:", file)
|
||||
}
|
||||
assert.NoError(tb, err)
|
||||
defer f.Close()
|
||||
defer func() { _ = f.Close() }()
|
||||
|
||||
gz, err := gzip.NewReader(f)
|
||||
assert.NoError(tb, err)
|
||||
|
||||
+16
-16
@@ -18,7 +18,7 @@ func TestUnmarshalSimple(t *testing.T) {
|
||||
|
||||
err := toml.Unmarshal(doc, &d)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
t.Error(err)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -38,7 +38,7 @@ func BenchmarkUnmarshal(b *testing.B) {
|
||||
|
||||
err := toml.Unmarshal(doc, &d)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
b.Error(err)
|
||||
}
|
||||
}
|
||||
})
|
||||
@@ -52,7 +52,7 @@ func BenchmarkUnmarshal(b *testing.B) {
|
||||
d := map[string]interface{}{}
|
||||
err := toml.Unmarshal(doc, &d)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
b.Error(err)
|
||||
}
|
||||
}
|
||||
})
|
||||
@@ -72,7 +72,7 @@ func BenchmarkUnmarshal(b *testing.B) {
|
||||
d := benchmarkDoc{}
|
||||
err := toml.Unmarshal(bytes, &d)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
b.Error(err)
|
||||
}
|
||||
}
|
||||
})
|
||||
@@ -85,7 +85,7 @@ func BenchmarkUnmarshal(b *testing.B) {
|
||||
d := map[string]interface{}{}
|
||||
err := toml.Unmarshal(bytes, &d)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
b.Error(err)
|
||||
}
|
||||
}
|
||||
})
|
||||
@@ -99,7 +99,7 @@ func BenchmarkUnmarshal(b *testing.B) {
|
||||
d := map[string]interface{}{}
|
||||
err := toml.Unmarshal(hugoFrontMatterbytes, &d)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
b.Error(err)
|
||||
}
|
||||
}
|
||||
})
|
||||
@@ -123,7 +123,7 @@ func BenchmarkMarshal(b *testing.B) {
|
||||
|
||||
err := toml.Unmarshal(doc, &d)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
b.Error(err)
|
||||
}
|
||||
|
||||
b.ReportAllocs()
|
||||
@@ -134,7 +134,7 @@ func BenchmarkMarshal(b *testing.B) {
|
||||
for i := 0; i < b.N; i++ {
|
||||
out, err = marshal(d)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
b.Error(err)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -145,7 +145,7 @@ func BenchmarkMarshal(b *testing.B) {
|
||||
d := map[string]interface{}{}
|
||||
err := toml.Unmarshal(doc, &d)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
b.Error(err)
|
||||
}
|
||||
|
||||
b.ReportAllocs()
|
||||
@@ -156,7 +156,7 @@ func BenchmarkMarshal(b *testing.B) {
|
||||
for i := 0; i < b.N; i++ {
|
||||
out, err = marshal(d)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
b.Error(err)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -174,7 +174,7 @@ func BenchmarkMarshal(b *testing.B) {
|
||||
d := benchmarkDoc{}
|
||||
err := toml.Unmarshal(bytes, &d)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
b.Error(err)
|
||||
}
|
||||
b.ReportAllocs()
|
||||
b.ResetTimer()
|
||||
@@ -184,7 +184,7 @@ func BenchmarkMarshal(b *testing.B) {
|
||||
for i := 0; i < b.N; i++ {
|
||||
out, err = marshal(d)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
b.Error(err)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -195,7 +195,7 @@ func BenchmarkMarshal(b *testing.B) {
|
||||
d := map[string]interface{}{}
|
||||
err := toml.Unmarshal(bytes, &d)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
b.Error(err)
|
||||
}
|
||||
|
||||
b.ReportAllocs()
|
||||
@@ -205,7 +205,7 @@ func BenchmarkMarshal(b *testing.B) {
|
||||
for i := 0; i < b.N; i++ {
|
||||
out, err = marshal(d)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
b.Error(err)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -217,7 +217,7 @@ func BenchmarkMarshal(b *testing.B) {
|
||||
d := map[string]interface{}{}
|
||||
err := toml.Unmarshal(hugoFrontMatterbytes, &d)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
b.Error(err)
|
||||
}
|
||||
|
||||
b.ReportAllocs()
|
||||
@@ -228,7 +228,7 @@ func BenchmarkMarshal(b *testing.B) {
|
||||
for i := 0; i < b.N; i++ {
|
||||
out, err = marshal(d)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
b.Error(err)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user