Skip to content

Commit a43edc8

Browse files
authored
chore: enable unused-parameter from revive (#2949)
Signed-off-by: Matthieu MOREL <[email protected]>
1 parent 425d849 commit a43edc8

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

41 files changed

+122
-123
lines changed

.golangci.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,6 @@ linters-settings:
6868
disabled: true
6969
- name: unreachable-code
7070
- name: unused-parameter
71-
disabled: true
7271
- name: use-any
7372
- name: var-declaration
7473
- name: var-naming

docker.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -998,7 +998,7 @@ func (p *DockerProvider) BuildImage(ctx context.Context, img ImageBuildInfo) (st
998998
return resp, nil
999999
},
10001000
backoff.WithContext(backoff.NewExponentialBackOff(), ctx),
1001-
func(err error, duration time.Duration) {
1001+
func(err error, _ time.Duration) {
10021002
p.Logger.Printf("Failed to build image: %s, will retry", err)
10031003
},
10041004
)
@@ -1414,7 +1414,7 @@ func (p *DockerProvider) attemptToPullImage(ctx context.Context, tag string, pul
14141414
return nil
14151415
},
14161416
backoff.WithContext(backoff.NewExponentialBackOff(), ctx),
1417-
func(err error, duration time.Duration) {
1417+
func(err error, _ time.Duration) {
14181418
p.Logger.Printf("Failed to pull image: %s, will retry", err)
14191419
},
14201420
)

docker_auth_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ func TestDockerImageAuth(t *testing.T) {
140140
t.Cleanup(func() {
141141
defaultRegistryFn = origDefaultRegistryFn
142142
})
143-
defaultRegistryFn = func(ctx context.Context) string {
143+
defaultRegistryFn = func(_ context.Context) string {
144144
return ""
145145
}
146146

internal/core/docker_host.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -240,7 +240,7 @@ func isHostNotSet(err error) bool {
240240
}
241241

242242
// dockerHostFromEnv returns the docker host from the DOCKER_HOST environment variable, if it's not empty
243-
func dockerHostFromEnv(ctx context.Context) (string, error) {
243+
func dockerHostFromEnv(_ context.Context) (string, error) {
244244
if dockerHostPath := os.Getenv("DOCKER_HOST"); dockerHostPath != "" {
245245
return dockerHostPath, nil
246246
}
@@ -263,7 +263,7 @@ func dockerHostFromContext(ctx context.Context) (string, error) {
263263
}
264264

265265
// dockerHostFromProperties returns the docker host from the ~/.testcontainers.properties file, if it's not empty
266-
func dockerHostFromProperties(ctx context.Context) (string, error) {
266+
func dockerHostFromProperties(_ context.Context) (string, error) {
267267
cfg := config.Read()
268268
socketPath := cfg.Host
269269
if socketPath != "" {
@@ -285,7 +285,7 @@ func dockerSocketOverridePath() (string, error) {
285285

286286
// dockerSocketPath returns the docker socket from the default docker socket path, if it's not empty
287287
// and the socket exists
288-
func dockerSocketPath(ctx context.Context) (string, error) {
288+
func dockerSocketPath(_ context.Context) (string, error) {
289289
if fileExists(DockerSocketPath) {
290290
return DockerSocketPathWithSchema, nil
291291
}
@@ -294,7 +294,7 @@ func dockerSocketPath(ctx context.Context) (string, error) {
294294
}
295295

296296
// testcontainersHostFromProperties returns the testcontainers host from the ~/.testcontainers.properties file, if it's not empty
297-
func testcontainersHostFromProperties(ctx context.Context) (string, error) {
297+
func testcontainersHostFromProperties(_ context.Context) (string, error) {
298298
cfg := config.Read()
299299
testcontainersHost := cfg.TestcontainersHost
300300
if testcontainersHost != "" {

internal/core/docker_host_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -312,7 +312,7 @@ type mockCli struct {
312312

313313
// Info returns a mock implementation of types.Info, which is handy for detecting the operating system,
314314
// which is used to determine the default docker socket path.
315-
func (m mockCli) Info(ctx context.Context) (system.Info, error) {
315+
func (m mockCli) Info(_ context.Context) (system.Info, error) {
316316
return system.Info{
317317
OperatingSystem: m.OS,
318318
}, nil

lifecycle.go

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -61,67 +61,67 @@ var DefaultLoggingHook = func(logger Logging) ContainerLifecycleHooks {
6161

6262
return ContainerLifecycleHooks{
6363
PreBuilds: []ContainerRequestHook{
64-
func(ctx context.Context, req ContainerRequest) error {
64+
func(_ context.Context, req ContainerRequest) error {
6565
logger.Printf("🐳 Building image %s:%s", req.GetRepo(), req.GetTag())
6666
return nil
6767
},
6868
},
6969
PostBuilds: []ContainerRequestHook{
70-
func(ctx context.Context, req ContainerRequest) error {
70+
func(_ context.Context, req ContainerRequest) error {
7171
logger.Printf("✅ Built image %s", req.Image)
7272
return nil
7373
},
7474
},
7575
PreCreates: []ContainerRequestHook{
76-
func(ctx context.Context, req ContainerRequest) error {
76+
func(_ context.Context, req ContainerRequest) error {
7777
logger.Printf("🐳 Creating container for image %s", req.Image)
7878
return nil
7979
},
8080
},
8181
PostCreates: []ContainerHook{
82-
func(ctx context.Context, c Container) error {
82+
func(_ context.Context, c Container) error {
8383
logger.Printf("✅ Container created: %s", shortContainerID(c))
8484
return nil
8585
},
8686
},
8787
PreStarts: []ContainerHook{
88-
func(ctx context.Context, c Container) error {
88+
func(_ context.Context, c Container) error {
8989
logger.Printf("🐳 Starting container: %s", shortContainerID(c))
9090
return nil
9191
},
9292
},
9393
PostStarts: []ContainerHook{
94-
func(ctx context.Context, c Container) error {
94+
func(_ context.Context, c Container) error {
9595
logger.Printf("✅ Container started: %s", shortContainerID(c))
9696
return nil
9797
},
9898
},
9999
PostReadies: []ContainerHook{
100-
func(ctx context.Context, c Container) error {
100+
func(_ context.Context, c Container) error {
101101
logger.Printf("🔔 Container is ready: %s", shortContainerID(c))
102102
return nil
103103
},
104104
},
105105
PreStops: []ContainerHook{
106-
func(ctx context.Context, c Container) error {
106+
func(_ context.Context, c Container) error {
107107
logger.Printf("🐳 Stopping container: %s", shortContainerID(c))
108108
return nil
109109
},
110110
},
111111
PostStops: []ContainerHook{
112-
func(ctx context.Context, c Container) error {
112+
func(_ context.Context, c Container) error {
113113
logger.Printf("✅ Container stopped: %s", shortContainerID(c))
114114
return nil
115115
},
116116
},
117117
PreTerminates: []ContainerHook{
118-
func(ctx context.Context, c Container) error {
118+
func(_ context.Context, c Container) error {
119119
logger.Printf("🐳 Terminating container: %s", shortContainerID(c))
120120
return nil
121121
},
122122
},
123123
PostTerminates: []ContainerHook{
124-
func(ctx context.Context, c Container) error {
124+
func(_ context.Context, c Container) error {
125125
logger.Printf("🚫 Container terminated: %s", shortContainerID(c))
126126
return nil
127127
},
@@ -199,7 +199,7 @@ var defaultLogConsumersHook = func(cfg *LogConsumerConfig) ContainerLifecycleHoo
199199
PostStops: []ContainerHook{
200200
// Stop the log production.
201201
// See combineContainerHooks for the order of execution.
202-
func(ctx context.Context, c Container) error {
202+
func(_ context.Context, c Container) error {
203203
if cfg == nil || len(cfg.Consumers) == 0 {
204204
return nil
205205
}
@@ -266,7 +266,7 @@ var defaultReadinessHook = func() ContainerLifecycleHooks {
266266
return checkPortsMapped(jsonRaw.NetworkSettings.Ports, dockerContainer.exposedPorts)
267267
},
268268
b,
269-
func(err error, duration time.Duration) {
269+
func(err error, _ time.Duration) {
270270
dockerContainer.logger.Printf("All requested ports were not exposed: %v", err)
271271
},
272272
)

lifecycle_test.go

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -541,91 +541,91 @@ func TestLifecycleHooks(t *testing.T) {
541541
LifecycleHooks: []ContainerLifecycleHooks{
542542
{
543543
PreCreates: []ContainerRequestHook{
544-
func(ctx context.Context, req ContainerRequest) error {
544+
func(_ context.Context, _ ContainerRequest) error {
545545
prints = append(prints, "pre-create hook 1")
546546
return nil
547547
},
548-
func(ctx context.Context, req ContainerRequest) error {
548+
func(_ context.Context, _ ContainerRequest) error {
549549
prints = append(prints, "pre-create hook 2")
550550
return nil
551551
},
552552
},
553553
PostCreates: []ContainerHook{
554-
func(ctx context.Context, c Container) error {
554+
func(_ context.Context, _ Container) error {
555555
prints = append(prints, "post-create hook 1")
556556
return nil
557557
},
558-
func(ctx context.Context, c Container) error {
558+
func(_ context.Context, _ Container) error {
559559
prints = append(prints, "post-create hook 2")
560560
return nil
561561
},
562562
},
563563
PreStarts: []ContainerHook{
564-
func(ctx context.Context, c Container) error {
564+
func(_ context.Context, _ Container) error {
565565
prints = append(prints, "pre-start hook 1")
566566
return nil
567567
},
568-
func(ctx context.Context, c Container) error {
568+
func(_ context.Context, _ Container) error {
569569
prints = append(prints, "pre-start hook 2")
570570
return nil
571571
},
572572
},
573573
PostStarts: []ContainerHook{
574-
func(ctx context.Context, c Container) error {
574+
func(_ context.Context, _ Container) error {
575575
prints = append(prints, "post-start hook 1")
576576
return nil
577577
},
578-
func(ctx context.Context, c Container) error {
578+
func(_ context.Context, _ Container) error {
579579
prints = append(prints, "post-start hook 2")
580580
return nil
581581
},
582582
},
583583
PostReadies: []ContainerHook{
584-
func(ctx context.Context, c Container) error {
584+
func(_ context.Context, _ Container) error {
585585
prints = append(prints, "post-ready hook 1")
586586
return nil
587587
},
588-
func(ctx context.Context, c Container) error {
588+
func(_ context.Context, _ Container) error {
589589
prints = append(prints, "post-ready hook 2")
590590
return nil
591591
},
592592
},
593593
PreStops: []ContainerHook{
594-
func(ctx context.Context, c Container) error {
594+
func(_ context.Context, _ Container) error {
595595
prints = append(prints, "pre-stop hook 1")
596596
return nil
597597
},
598-
func(ctx context.Context, c Container) error {
598+
func(_ context.Context, _ Container) error {
599599
prints = append(prints, "pre-stop hook 2")
600600
return nil
601601
},
602602
},
603603
PostStops: []ContainerHook{
604-
func(ctx context.Context, c Container) error {
604+
func(_ context.Context, _ Container) error {
605605
prints = append(prints, "post-stop hook 1")
606606
return nil
607607
},
608-
func(ctx context.Context, c Container) error {
608+
func(_ context.Context, _ Container) error {
609609
prints = append(prints, "post-stop hook 2")
610610
return nil
611611
},
612612
},
613613
PreTerminates: []ContainerHook{
614-
func(ctx context.Context, c Container) error {
614+
func(_ context.Context, _ Container) error {
615615
prints = append(prints, "pre-terminate hook 1")
616616
return nil
617617
},
618-
func(ctx context.Context, c Container) error {
618+
func(_ context.Context, _ Container) error {
619619
prints = append(prints, "pre-terminate hook 2")
620620
return nil
621621
},
622622
},
623623
PostTerminates: []ContainerHook{
624-
func(ctx context.Context, c Container) error {
624+
func(_ context.Context, _ Container) error {
625625
prints = append(prints, "post-terminate hook 1")
626626
return nil
627627
},
628-
func(ctx context.Context, c Container) error {
628+
func(_ context.Context, _ Container) error {
629629
prints = append(prints, "post-terminate hook 2")
630630
return nil
631631
},
@@ -714,13 +714,13 @@ func TestCombineLifecycleHooks(t *testing.T) {
714714
prints := []string{}
715715

716716
preCreateFunc := func(prefix string, hook string, lifecycleID int, hookID int) func(ctx context.Context, req ContainerRequest) error {
717-
return func(ctx context.Context, _ ContainerRequest) error {
717+
return func(_ context.Context, _ ContainerRequest) error {
718718
prints = append(prints, fmt.Sprintf("[%s] pre-%s hook %d.%d", prefix, hook, lifecycleID, hookID))
719719
return nil
720720
}
721721
}
722722
hookFunc := func(prefix string, hookType string, hook string, lifecycleID int, hookID int) func(ctx context.Context, c Container) error {
723-
return func(ctx context.Context, _ Container) error {
723+
return func(_ context.Context, _ Container) error {
724724
prints = append(prints, fmt.Sprintf("[%s] %s-%s hook %d.%d", prefix, hookType, hook, lifecycleID, hookID))
725725
return nil
726726
}
@@ -975,19 +975,19 @@ func lifecycleHooksIsHonouredFn(t *testing.T, prints []string) {
975975

976976
func Test_combineContainerHooks(t *testing.T) {
977977
var funcID string
978-
defaultContainerRequestHook := func(ctx context.Context, req ContainerRequest) error {
978+
defaultContainerRequestHook := func(_ context.Context, _ ContainerRequest) error {
979979
funcID = "defaultContainerRequestHook"
980980
return nil
981981
}
982-
userContainerRequestHook := func(ctx context.Context, req ContainerRequest) error {
982+
userContainerRequestHook := func(_ context.Context, _ ContainerRequest) error {
983983
funcID = "userContainerRequestHook"
984984
return nil
985985
}
986-
defaultContainerHook := func(ctx context.Context, container Container) error {
986+
defaultContainerHook := func(_ context.Context, _ Container) error {
987987
funcID = "defaultContainerHook"
988988
return nil
989989
}
990-
userContainerHook := func(ctx context.Context, container Container) error {
990+
userContainerHook := func(_ context.Context, _ Container) error {
991991
funcID = "userContainerHook"
992992
return nil
993993
}

logger.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,13 +41,13 @@ type Logging interface {
4141
type noopLogger struct{}
4242

4343
// Printf implements Logging.
44-
func (n noopLogger) Printf(format string, v ...any) {
44+
func (n noopLogger) Printf(_ string, _ ...any) {
4545
// NOOP
4646
}
4747

4848
// Deprecated: this function will be removed in a future release
4949
// LogDockerServerInfo logs the docker server info using the provided logger and Docker client
50-
func LogDockerServerInfo(ctx context.Context, client client.APIClient, logger Logging) {
50+
func LogDockerServerInfo(_ context.Context, _ client.APIClient, _ Logging) {
5151
// NOOP
5252
}
5353

modulegen/cmd/modules/example.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ var newExampleCmd = &cobra.Command{
1010
Use: "example",
1111
Short: "Create a new Example",
1212
Long: "Create a new Example",
13-
RunE: func(cmd *cobra.Command, args []string) error {
13+
RunE: func(_ *cobra.Command, _ []string) error {
1414
return internal.Generate(tcModuleVar, false)
1515
},
1616
}

modulegen/cmd/modules/module.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ var newModuleCmd = &cobra.Command{
1010
Use: "module",
1111
Short: "Create a new Module",
1212
Long: "Create a new Module",
13-
RunE: func(cmd *cobra.Command, args []string) error {
13+
RunE: func(_ *cobra.Command, _ []string) error {
1414
return internal.Generate(tcModuleVar, true)
1515
},
1616
}

modules/clickhouse/clickhouse_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -286,7 +286,7 @@ func performReplicatedCRUD(t *testing.T, conn driver.Conn) ([]Test, error) {
286286
return res, nil
287287
},
288288
backoff.NewExponentialBackOff(),
289-
func(err error, duration time.Duration) {
289+
func(err error, _ time.Duration) {
290290
t.Log(err)
291291
},
292292
)
@@ -309,7 +309,7 @@ func performCRUD(t *testing.T, conn driver.Conn) ([]Test, error) {
309309
return getAllRows(conn)
310310
},
311311
backoff.NewExponentialBackOff(),
312-
func(err error, duration time.Duration) {
312+
func(err error, _ time.Duration) {
313313
t.Log(err)
314314
},
315315
)

0 commit comments

Comments
 (0)