From d1a5ec7839937fc4ea9b1faab80e8d10baddbfa5 Mon Sep 17 00:00:00 2001 From: Michael Eischer Date: Thu, 18 May 2023 19:23:32 +0200 Subject: [PATCH] Rename unused testing parameter to _ The parameter is an additional marker that the test helper must only be used for tests. --- internal/backend/retry/testing.go | 2 +- internal/debug/testing.go | 4 ++-- internal/repository/testing.go | 2 +- internal/restic/testing.go | 2 +- internal/ui/progress/counter_test.go | 2 +- internal/ui/progress/updater_test.go | 3 ++- 6 files changed, 8 insertions(+), 7 deletions(-) diff --git a/internal/backend/retry/testing.go b/internal/backend/retry/testing.go index 797573b03..ca019d202 100644 --- a/internal/backend/retry/testing.go +++ b/internal/backend/retry/testing.go @@ -3,6 +3,6 @@ package retry import "testing" // TestFastRetries reduces the initial retry delay to 1 millisecond -func TestFastRetries(t testing.TB) { +func TestFastRetries(_ testing.TB) { fastRetries = true } diff --git a/internal/debug/testing.go b/internal/debug/testing.go index c9ceae0ea..31cbd7931 100644 --- a/internal/debug/testing.go +++ b/internal/debug/testing.go @@ -8,7 +8,7 @@ import ( // TestLogToStderr configures debug to log to stderr if not the debug log is // not already configured and returns whether logging was enabled. -func TestLogToStderr(t testing.TB) bool { +func TestLogToStderr(_ testing.TB) bool { if opts.isEnabled { return false } @@ -17,7 +17,7 @@ func TestLogToStderr(t testing.TB) bool { return true } -func TestDisableLog(t testing.TB) { +func TestDisableLog(_ testing.TB) { opts.logger = nil opts.isEnabled = false } diff --git a/internal/repository/testing.go b/internal/repository/testing.go index 879650336..4936cc368 100644 --- a/internal/repository/testing.go +++ b/internal/repository/testing.go @@ -34,7 +34,7 @@ func TestUseLowSecurityKDFParameters(t logger) { } // TestBackend returns a fully configured in-memory backend. -func TestBackend(t testing.TB) restic.Backend { +func TestBackend(_ testing.TB) restic.Backend { return mem.New() } diff --git a/internal/restic/testing.go b/internal/restic/testing.go index dda9eff44..658935eb6 100644 --- a/internal/restic/testing.go +++ b/internal/restic/testing.go @@ -209,7 +209,7 @@ func TestParseHandle(s string, t BlobType) BlobHandle { } // TestSetSnapshotID sets the snapshot's ID. -func TestSetSnapshotID(t testing.TB, sn *Snapshot, id ID) { +func TestSetSnapshotID(_ testing.TB, sn *Snapshot, id ID) { sn.id = &id } diff --git a/internal/ui/progress/counter_test.go b/internal/ui/progress/counter_test.go index 49c694e06..a0bb22d5a 100644 --- a/internal/ui/progress/counter_test.go +++ b/internal/ui/progress/counter_test.go @@ -59,7 +59,7 @@ func TestCounter(t *testing.T) { t.Log("number of calls:", ncalls) } -func TestCounterNil(t *testing.T) { +func TestCounterNil(_ *testing.T) { // Shouldn't panic. var c *progress.Counter c.Add(1) diff --git a/internal/ui/progress/updater_test.go b/internal/ui/progress/updater_test.go index 5b5207dd5..45db019ba 100644 --- a/internal/ui/progress/updater_test.go +++ b/internal/ui/progress/updater_test.go @@ -26,7 +26,8 @@ func TestUpdater(t *testing.T) { test.Assert(t, ncalls > 0, "no progress was reported") } -func TestUpdaterStopTwice(t *testing.T) { +func TestUpdaterStopTwice(_ *testing.T) { + // must not panic c := progress.NewUpdater(0, func(runtime time.Duration, final bool) {}) c.Done() c.Done()