build: update revive

And remove some unused variables.
This commit is contained in:
Vincent Bernat
2025-09-09 07:39:00 +02:00
parent ab9e7107f8
commit 31b6591e0e
8 changed files with 28 additions and 28 deletions

View File

@@ -256,7 +256,7 @@ module2:
} }
func TestHTTPConfiguration(t *testing.T) { func TestHTTPConfiguration(t *testing.T) {
ts := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { ts := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, _ *http.Request) {
w.Header().Set("Content-Type", "application/yaml; charset=utf-8") w.Header().Set("Content-Type", "application/yaml; charset=utf-8")
fmt.Fprint(w, `--- fmt.Fprint(w, `---
module1: module1:

View File

@@ -390,18 +390,6 @@ func TestSubnetMapLookupOrDefault(t *testing.T) {
} }
}) })
t.Run("nil", func(t *testing.T) {
var sm *helpers.SubnetMap[string]
value := sm.LookupOrDefault(netip.MustParseAddr("::ffff:192.0.2.1"), "default")
if value != "default" {
t.Fatalf("LookupOrDefault() = %q, want %q", value, "default")
}
})
}
func TestSubnetMapSet(t *testing.T) {
sm := &helpers.SubnetMap[string]{}
t.Run("set IPv6 subnet", func(t *testing.T) { t.Run("set IPv6 subnet", func(t *testing.T) {
prefix := netip.MustParsePrefix("2001:db8::/64") prefix := netip.MustParsePrefix("2001:db8::/64")
sm.Set(prefix, "test-value") sm.Set(prefix, "test-value")
@@ -491,7 +479,7 @@ func TestSubnetMapUpdatePanic(t *testing.T) {
} }
}() }()
prefix := netip.MustParsePrefix("192.0.2.0/24") prefix := netip.MustParsePrefix("192.0.2.0/24")
sm.Update(prefix, func(old int, exists bool) int { return 1 }) sm.Update(prefix, func(int, bool) int { return 1 })
}) })
} }

View File

@@ -20,7 +20,7 @@ func TestHandler(t *testing.T) {
h := httpserver.NewMock(t, r) h := httpserver.NewMock(t, r)
h.AddHandler("/test", h.AddHandler("/test",
http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { http.HandlerFunc(func(w http.ResponseWriter, _ *http.Request) {
fmt.Fprintf(w, "Hello !") fmt.Fprintf(w, "Hello !")
})) }))
@@ -78,7 +78,7 @@ func TestGinRouterPanic(t *testing.T) {
r := reporter.NewMock(t) r := reporter.NewMock(t)
h := httpserver.NewMock(t, r) h := httpserver.NewMock(t, r)
h.GinRouter.GET("/api/v0/test", func(c *gin.Context) { h.GinRouter.GET("/api/v0/test", func(*gin.Context) {
panic("heeeelp") panic("heeeelp")
}) })

View File

@@ -37,7 +37,7 @@ func TestEmptyHealthcheck(t *testing.T) {
func TestOneHealthcheck(t *testing.T) { func TestOneHealthcheck(t *testing.T) {
r := reporter.NewMock(t) r := reporter.NewMock(t)
r.RegisterHealthcheck("hc1", func(ctx context.Context) reporter.HealthcheckResult { r.RegisterHealthcheck("hc1", func(context.Context) reporter.HealthcheckResult {
return reporter.HealthcheckResult{reporter.HealthcheckOK, "all well"} return reporter.HealthcheckResult{reporter.HealthcheckOK, "all well"}
}) })
testHealthchecks(context.Background(), t, r, testHealthchecks(context.Background(), t, r,
@@ -51,10 +51,10 @@ func TestOneHealthcheck(t *testing.T) {
func TestFailingHealthcheck(t *testing.T) { func TestFailingHealthcheck(t *testing.T) {
r := reporter.NewMock(t) r := reporter.NewMock(t)
r.RegisterHealthcheck("hc1", func(ctx context.Context) reporter.HealthcheckResult { r.RegisterHealthcheck("hc1", func(context.Context) reporter.HealthcheckResult {
return reporter.HealthcheckResult{reporter.HealthcheckOK, "all well"} return reporter.HealthcheckResult{reporter.HealthcheckOK, "all well"}
}) })
r.RegisterHealthcheck("hc2", func(ctx context.Context) reporter.HealthcheckResult { r.RegisterHealthcheck("hc2", func(context.Context) reporter.HealthcheckResult {
return reporter.HealthcheckResult{reporter.HealthcheckError, "not so good"} return reporter.HealthcheckResult{reporter.HealthcheckError, "not so good"}
}) })
testHealthchecks(context.Background(), t, r, testHealthchecks(context.Background(), t, r,
@@ -69,7 +69,7 @@ func TestFailingHealthcheck(t *testing.T) {
func TestHealthcheckCancelContext(t *testing.T) { func TestHealthcheckCancelContext(t *testing.T) {
r := reporter.NewMock(t) r := reporter.NewMock(t)
r.RegisterHealthcheck("hc1", func(ctx context.Context) reporter.HealthcheckResult { r.RegisterHealthcheck("hc1", func(context.Context) reporter.HealthcheckResult {
return reporter.HealthcheckResult{reporter.HealthcheckOK, "all well"} return reporter.HealthcheckResult{reporter.HealthcheckOK, "all well"}
}) })
r.RegisterHealthcheck("hc2", func(ctx context.Context) reporter.HealthcheckResult { r.RegisterHealthcheck("hc2", func(ctx context.Context) reporter.HealthcheckResult {
@@ -114,10 +114,10 @@ func TestChannelHealthcheck(t *testing.T) {
func TestHealthcheckHTTPHandler(t *testing.T) { func TestHealthcheckHTTPHandler(t *testing.T) {
r := reporter.NewMock(t) r := reporter.NewMock(t)
r.RegisterHealthcheck("hc1", func(ctx context.Context) reporter.HealthcheckResult { r.RegisterHealthcheck("hc1", func(context.Context) reporter.HealthcheckResult {
return reporter.HealthcheckResult{reporter.HealthcheckOK, "all well"} return reporter.HealthcheckResult{reporter.HealthcheckOK, "all well"}
}) })
r.RegisterHealthcheck("hc2", func(ctx context.Context) reporter.HealthcheckResult { r.RegisterHealthcheck("hc2", func(context.Context) reporter.HealthcheckResult {
return reporter.HealthcheckResult{reporter.HealthcheckError, "trying to be better"} return reporter.HealthcheckResult{reporter.HealthcheckError, "trying to be better"}
}) })

View File

@@ -95,7 +95,7 @@ func TestInsertMemory(t *testing.T) {
if err := conn.Do(ctx, ch.Query{ if err := conn.Do(ctx, ch.Query{
Body: input.Into("test_schema_insert"), Body: input.Into("test_schema_insert"),
Input: input, Input: input,
OnInput: func(ctx context.Context) error { OnInput: func(context.Context) error {
bf.Clear() bf.Clear()
// No more data to send! // No more data to send!
return io.EOF return io.EOF

9
go.mod
View File

@@ -67,9 +67,10 @@ require (
require ( require (
cloud.google.com/go/compute/metadata v0.7.0 // indirect cloud.google.com/go/compute/metadata v0.7.0 // indirect
codeberg.org/chavacava/garif v0.2.0 // indirect
filippo.io/edwards25519 v1.1.0 // indirect filippo.io/edwards25519 v1.1.0 // indirect
github.com/AlekSi/pointer v1.2.0 // indirect github.com/AlekSi/pointer v1.2.0 // indirect
github.com/BurntSushi/toml v1.4.1-0.20240526193622-a339e1f7089c // indirect github.com/BurntSushi/toml v1.5.0 // indirect
github.com/Microsoft/go-winio v0.6.2 // indirect github.com/Microsoft/go-winio v0.6.2 // indirect
github.com/andybalholm/brotli v1.2.0 // indirect github.com/andybalholm/brotli v1.2.0 // indirect
github.com/beorn7/perks v1.0.1 // indirect github.com/beorn7/perks v1.0.1 // indirect
@@ -137,8 +138,8 @@ require (
github.com/mattn/go-runewidth v0.0.16 // indirect github.com/mattn/go-runewidth v0.0.16 // indirect
github.com/mdlayher/netlink v1.7.2 // indirect github.com/mdlayher/netlink v1.7.2 // indirect
github.com/mdlayher/socket v0.5.1 // indirect github.com/mdlayher/socket v0.5.1 // indirect
github.com/mgechev/dots v0.0.0-20210922191527-e955255bf517 // indirect github.com/mgechev/dots v1.0.0 // indirect
github.com/mgechev/revive v1.7.0 // indirect github.com/mgechev/revive v1.12.0 // indirect
github.com/mna/pigeon v1.3.0 // indirect github.com/mna/pigeon v1.3.0 // indirect
github.com/moby/docker-image-spec v1.3.1 // indirect github.com/moby/docker-image-spec v1.3.1 // indirect
github.com/moby/sys/atomicwriter v0.1.0 // indirect github.com/moby/sys/atomicwriter v0.1.0 // indirect
@@ -168,7 +169,7 @@ require (
github.com/shopspring/decimal v1.4.0 // indirect github.com/shopspring/decimal v1.4.0 // indirect
github.com/sirikothe/gotextfsm v1.0.1-0.20200816110946-6aa2cfd355e4 // indirect github.com/sirikothe/gotextfsm v1.0.1-0.20200816110946-6aa2cfd355e4 // indirect
github.com/sirupsen/logrus v1.9.3 // indirect github.com/sirupsen/logrus v1.9.3 // indirect
github.com/spf13/afero v1.12.0 // indirect github.com/spf13/afero v1.14.0 // indirect
github.com/spf13/pflag v1.0.9 // indirect github.com/spf13/pflag v1.0.9 // indirect
github.com/ti-mo/netfilter v0.5.3 // indirect github.com/ti-mo/netfilter v0.5.3 // indirect
github.com/tklauser/go-sysconf v0.3.12 // indirect github.com/tklauser/go-sysconf v0.3.12 // indirect

11
go.sum
View File

@@ -1,5 +1,7 @@
cloud.google.com/go/compute/metadata v0.7.0 h1:PBWF+iiAerVNe8UCHxdOt6eHLVc3ydFeOCw78U8ytSU= cloud.google.com/go/compute/metadata v0.7.0 h1:PBWF+iiAerVNe8UCHxdOt6eHLVc3ydFeOCw78U8ytSU=
cloud.google.com/go/compute/metadata v0.7.0/go.mod h1:j5MvL9PprKL39t166CoB1uVHfQMs4tFQZZcKwksXUjo= cloud.google.com/go/compute/metadata v0.7.0/go.mod h1:j5MvL9PprKL39t166CoB1uVHfQMs4tFQZZcKwksXUjo=
codeberg.org/chavacava/garif v0.2.0 h1:F0tVjhYbuOCnvNcU3YSpO6b3Waw6Bimy4K0mM8y6MfY=
codeberg.org/chavacava/garif v0.2.0/go.mod h1:P2BPbVbT4QcvLZrORc2T29szK3xEOlnl0GiPTJmEqBQ=
filippo.io/edwards25519 v1.1.0 h1:FNf4tywRC1HmFuKW5xopWpigGjJKiJSV0Cqo0cJWDaA= filippo.io/edwards25519 v1.1.0 h1:FNf4tywRC1HmFuKW5xopWpigGjJKiJSV0Cqo0cJWDaA=
filippo.io/edwards25519 v1.1.0/go.mod h1:BxyFTGdWcka3PhytdK4V28tE5sGfRvvvRV7EaN4VDT4= filippo.io/edwards25519 v1.1.0/go.mod h1:BxyFTGdWcka3PhytdK4V28tE5sGfRvvvRV7EaN4VDT4=
github.com/AlekSi/pointer v1.2.0 h1:glcy/gc4h8HnG2Z3ZECSzZ1IX1x2JxRVuDzaJwQE0+w= github.com/AlekSi/pointer v1.2.0 h1:glcy/gc4h8HnG2Z3ZECSzZ1IX1x2JxRVuDzaJwQE0+w=
@@ -9,6 +11,8 @@ github.com/Azure/go-ansiterm v0.0.0-20210617225240-d185dfc1b5a1/go.mod h1:xomTg6
github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU=
github.com/BurntSushi/toml v1.4.1-0.20240526193622-a339e1f7089c h1:pxW6RcqyfI9/kWtOwnv/G+AzdKuy2ZrqINhenH4HyNs= github.com/BurntSushi/toml v1.4.1-0.20240526193622-a339e1f7089c h1:pxW6RcqyfI9/kWtOwnv/G+AzdKuy2ZrqINhenH4HyNs=
github.com/BurntSushi/toml v1.4.1-0.20240526193622-a339e1f7089c/go.mod h1:ukJfTF/6rtPPRCnwkur4qwRxa8vTRFBF0uk2lLoLwho= github.com/BurntSushi/toml v1.4.1-0.20240526193622-a339e1f7089c/go.mod h1:ukJfTF/6rtPPRCnwkur4qwRxa8vTRFBF0uk2lLoLwho=
github.com/BurntSushi/toml v1.5.0 h1:W5quZX/G/csjUnuI8SUYlsHs9M38FC7znL0lIO+DvMg=
github.com/BurntSushi/toml v1.5.0/go.mod h1:ukJfTF/6rtPPRCnwkur4qwRxa8vTRFBF0uk2lLoLwho=
github.com/ClickHouse/ch-go v0.67.0 h1:18MQF6vZHj+4/hTRaK7JbS/TIzn4I55wC+QzO24uiqc= github.com/ClickHouse/ch-go v0.67.0 h1:18MQF6vZHj+4/hTRaK7JbS/TIzn4I55wC+QzO24uiqc=
github.com/ClickHouse/ch-go v0.67.0/go.mod h1:2MSAeyVmgt+9a2k2SQPPG1b4qbTPzdGDpf1+bcHh+18= github.com/ClickHouse/ch-go v0.67.0/go.mod h1:2MSAeyVmgt+9a2k2SQPPG1b4qbTPzdGDpf1+bcHh+18=
github.com/ClickHouse/clickhouse-go/v2 v2.40.1 h1:PbwsHBgqXRydU7jKULD1C8CHmifczffvQqmFvltM2W4= github.com/ClickHouse/clickhouse-go/v2 v2.40.1 h1:PbwsHBgqXRydU7jKULD1C8CHmifczffvQqmFvltM2W4=
@@ -285,8 +289,12 @@ github.com/mdlayher/socket v0.5.1 h1:VZaqt6RkGkt2OE9l3GcC6nZkqD3xKeQLyfleW/uBcos
github.com/mdlayher/socket v0.5.1/go.mod h1:TjPLHI1UgwEv5J1B5q0zTZq12A/6H7nKmtTanQE37IQ= github.com/mdlayher/socket v0.5.1/go.mod h1:TjPLHI1UgwEv5J1B5q0zTZq12A/6H7nKmtTanQE37IQ=
github.com/mgechev/dots v0.0.0-20210922191527-e955255bf517 h1:zpIH83+oKzcpryru8ceC6BxnoG8TBrhgAvRg8obzup0= github.com/mgechev/dots v0.0.0-20210922191527-e955255bf517 h1:zpIH83+oKzcpryru8ceC6BxnoG8TBrhgAvRg8obzup0=
github.com/mgechev/dots v0.0.0-20210922191527-e955255bf517/go.mod h1:KQ7+USdGKfpPjXk4Ga+5XxQM4Lm4e3gAogrreFAYpOg= github.com/mgechev/dots v0.0.0-20210922191527-e955255bf517/go.mod h1:KQ7+USdGKfpPjXk4Ga+5XxQM4Lm4e3gAogrreFAYpOg=
github.com/mgechev/dots v1.0.0 h1:o+4OJ3OjWzgQHGJXKfJ8rbH4dqDugu5BiEy84nxg0k4=
github.com/mgechev/dots v1.0.0/go.mod h1:rykuMydC9t3wfkM+ccYH3U3ss03vZGg6h3hmOznXLH0=
github.com/mgechev/revive v1.7.0 h1:JyeQ4yO5K8aZhIKf5rec56u0376h8AlKNQEmjfkjKlY= github.com/mgechev/revive v1.7.0 h1:JyeQ4yO5K8aZhIKf5rec56u0376h8AlKNQEmjfkjKlY=
github.com/mgechev/revive v1.7.0/go.mod h1:qZnwcNhoguE58dfi96IJeSTPeZQejNeoMQLUZGi4SW4= github.com/mgechev/revive v1.7.0/go.mod h1:qZnwcNhoguE58dfi96IJeSTPeZQejNeoMQLUZGi4SW4=
github.com/mgechev/revive v1.12.0 h1:Q+/kkbbwerrVYPv9d9efaPGmAO/NsxwW/nE6ahpQaCU=
github.com/mgechev/revive v1.12.0/go.mod h1:VXsY2LsTigk8XU9BpZauVLjVrhICMOV3k1lpB3CXrp8=
github.com/mna/pigeon v1.3.0 h1:/3fzVrl1C2RK3x04tyL+ribn+3S3VSEFFbCFLmRPAoc= github.com/mna/pigeon v1.3.0 h1:/3fzVrl1C2RK3x04tyL+ribn+3S3VSEFFbCFLmRPAoc=
github.com/mna/pigeon v1.3.0/go.mod h1:SKQNHonx2q9U2QSSoPtMigExj+vQ1mOpL7UVFQF/IA0= github.com/mna/pigeon v1.3.0/go.mod h1:SKQNHonx2q9U2QSSoPtMigExj+vQ1mOpL7UVFQF/IA0=
github.com/moby/docker-image-spec v1.3.1 h1:jMKff3w6PgbfSa69GfNg+zN/XLhfXJGnEx3Nl2EsFP0= github.com/moby/docker-image-spec v1.3.1 h1:jMKff3w6PgbfSa69GfNg+zN/XLhfXJGnEx3Nl2EsFP0=
@@ -406,6 +414,8 @@ github.com/slayercat/GoSNMPServer v0.5.2 h1:IK2d3kz6JoiYHbAZT5H7hrQQRzAD7rxF0iJZ
github.com/slayercat/GoSNMPServer v0.5.2/go.mod h1:6taMSIwudR+7pKRO6dz2U+xoNccZds8eiMVlEN66fXY= github.com/slayercat/GoSNMPServer v0.5.2/go.mod h1:6taMSIwudR+7pKRO6dz2U+xoNccZds8eiMVlEN66fXY=
github.com/spf13/afero v1.12.0 h1:UcOPyRBYczmFn6yvphxkn9ZEOY65cpwGKb5mL36mrqs= github.com/spf13/afero v1.12.0 h1:UcOPyRBYczmFn6yvphxkn9ZEOY65cpwGKb5mL36mrqs=
github.com/spf13/afero v1.12.0/go.mod h1:ZTlWwG4/ahT8W7T0WQ5uYmjI9duaLQGy3Q2OAl4sk/4= github.com/spf13/afero v1.12.0/go.mod h1:ZTlWwG4/ahT8W7T0WQ5uYmjI9duaLQGy3Q2OAl4sk/4=
github.com/spf13/afero v1.14.0 h1:9tH6MapGnn/j0eb0yIXiLjERO8RB6xIVZRDCX7PtqWA=
github.com/spf13/afero v1.14.0/go.mod h1:acJQ8t0ohCGuMN3O+Pv0V0hgMxNYDlvdk+VTfyZmbYo=
github.com/spf13/cobra v1.10.1 h1:lJeBwCfmrnXthfAupyUTzJ/J4Nc1RsHC/mSRU2dll/s= github.com/spf13/cobra v1.10.1 h1:lJeBwCfmrnXthfAupyUTzJ/J4Nc1RsHC/mSRU2dll/s=
github.com/spf13/cobra v1.10.1/go.mod h1:7SmJGaTHFVBY0jW4NXGluQoLvhqFQM+6XSKD+P4XaB0= github.com/spf13/cobra v1.10.1/go.mod h1:7SmJGaTHFVBY0jW4NXGluQoLvhqFQM+6XSKD+P4XaB0=
github.com/spf13/pflag v1.0.9 h1:9exaQaMOCwffKiiiYk6/BndUBv+iRViNW+4lEMi0PvY= github.com/spf13/pflag v1.0.9 h1:9exaQaMOCwffKiiiYk6/BndUBv+iRViNW+4lEMi0PvY=
@@ -636,6 +646,7 @@ golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8T
golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
gonum.org/v1/gonum v0.16.0 h1:5+ul4Swaf3ESvrOnidPp4GZbzf0mxVQpDCYUQE7OJfk= gonum.org/v1/gonum v0.16.0 h1:5+ul4Swaf3ESvrOnidPp4GZbzf0mxVQpDCYUQE7OJfk=
gonum.org/v1/gonum v0.16.0/go.mod h1:fef3am4MQ93R2HHpKnLk4/Tbh/s0+wqD5nfa6Pnwy4E= gonum.org/v1/gonum v0.16.0/go.mod h1:fef3am4MQ93R2HHpKnLk4/Tbh/s0+wqD5nfa6Pnwy4E=
google.golang.org/genproto v0.0.0-20230410155749-daa745c078e1 h1:KpwkzHKEF7B9Zxg18WzOa7djJ+Ha5DzthMyZYQfEn2A=
google.golang.org/genproto v0.0.0-20241118233622-e639e219e697 h1:ToEetK57OidYuqD4Q5w+vfEnPvPpuTwedCNVohYJfNk= google.golang.org/genproto v0.0.0-20241118233622-e639e219e697 h1:ToEetK57OidYuqD4Q5w+vfEnPvPpuTwedCNVohYJfNk=
google.golang.org/genproto/googleapis/api v0.0.0-20250707201910-8d1bb00bc6a7 h1:FiusG7LWj+4byqhbvmB+Q93B/mOxJLN2DTozDuZm4EU= google.golang.org/genproto/googleapis/api v0.0.0-20250707201910-8d1bb00bc6a7 h1:FiusG7LWj+4byqhbvmB+Q93B/mOxJLN2DTozDuZm4EU=
google.golang.org/genproto/googleapis/api v0.0.0-20250707201910-8d1bb00bc6a7/go.mod h1:kXqgZtrWaf6qS3jZOCnCH7WYfrvFjkC51bM8fz3RsCA= google.golang.org/genproto/googleapis/api v0.0.0-20250707201910-8d1bb00bc6a7/go.mod h1:kXqgZtrWaf6qS3jZOCnCH7WYfrvFjkC51bM8fz3RsCA=

View File

@@ -98,7 +98,7 @@ func TestInsertMemory(t *testing.T) {
// OnInput is called to prepare Input data before encoding and sending // OnInput is called to prepare Input data before encoding and sending
// to ClickHouse server. // to ClickHouse server.
OnInput: func(ctx context.Context) error { OnInput: func(context.Context) error {
// On OnInput call, you should fill the input data. // On OnInput call, you should fill the input data.
// //
// NB: You should reset the input columns, they are // NB: You should reset the input columns, they are