From 44bf8dc582b0589a7c7f2f24ce93198764b5425c Mon Sep 17 00:00:00 2001 From: Martin Smith Date: Fri, 28 Feb 2025 19:52:43 +0000 Subject: [PATCH] Rename unused parameters to '_'. --- cmd/restic/integration_helpers_windows_test.go | 4 ++-- internal/archiver/archiver_test.go | 2 +- internal/archiver/file_saver_test.go | 2 +- internal/backend/local/local_windows.go | 6 +++--- internal/feature/testing.go | 2 +- internal/fs/setflags_other.go | 2 +- internal/repository/index/associated_data_test.go | 2 +- internal/repository/testing.go | 2 +- internal/restic/lock_windows.go | 2 +- internal/restorer/filerestorer_test.go | 4 ++-- internal/restorer/restorer_test.go | 4 ++-- internal/ui/termstatus/background.go | 2 +- 12 files changed, 17 insertions(+), 17 deletions(-) diff --git a/cmd/restic/integration_helpers_windows_test.go b/cmd/restic/integration_helpers_windows_test.go index 4f2c8b54f..42ced7e46 100644 --- a/cmd/restic/integration_helpers_windows_test.go +++ b/cmd/restic/integration_helpers_windows_test.go @@ -28,11 +28,11 @@ func (e *dirEntry) equals(out io.Writer, other *dirEntry) bool { return true } -func nlink(info os.FileInfo) uint64 { +func nlink(_ os.FileInfo) uint64 { return 1 } -func inode(info os.FileInfo) uint64 { +func inode(_ os.FileInfo) uint64 { return uint64(0) } diff --git a/internal/archiver/archiver_test.go b/internal/archiver/archiver_test.go index a5fa37605..9a25f7fad 100644 --- a/internal/archiver/archiver_test.go +++ b/internal/archiver/archiver_test.go @@ -2495,7 +2495,7 @@ type missingFS struct { errorOnOpen bool } -func (fs *missingFS) OpenFile(name string, flag int, metadataOnly bool) (fs.File, error) { +func (fs *missingFS) OpenFile(_ string, _ int, _ bool) (fs.File, error) { if fs.errorOnOpen { return nil, os.ErrNotExist } diff --git a/internal/archiver/file_saver_test.go b/internal/archiver/file_saver_test.go index ce862f6fe..af4ed0157 100644 --- a/internal/archiver/file_saver_test.go +++ b/internal/archiver/file_saver_test.go @@ -30,7 +30,7 @@ func createTestFiles(t testing.TB, num int) (files []string) { return files } -func startFileSaver(ctx context.Context, t testing.TB, fsInst fs.FS) (*fileSaver, context.Context, *errgroup.Group) { +func startFileSaver(ctx context.Context, t testing.TB, _ fs.FS) (*fileSaver, context.Context, *errgroup.Group) { wg, ctx := errgroup.WithContext(ctx) saveBlob := func(ctx context.Context, tpe restic.BlobType, buf *buffer, _ string, cb func(saveBlobResponse)) { diff --git a/internal/backend/local/local_windows.go b/internal/backend/local/local_windows.go index d69b9eec8..dd372941d 100644 --- a/internal/backend/local/local_windows.go +++ b/internal/backend/local/local_windows.go @@ -5,14 +5,14 @@ import ( ) // Can't explicitly flush directory changes on Windows. -func fsyncDir(dir string) error { return nil } +func fsyncDir(_ string) error { return nil } // Windows is not macOS. -func isMacENOTTY(err error) bool { return false } +func isMacENOTTY(_ error) bool { return false } // We don't modify read-only on windows, // since it will make us unable to delete the file, // and this isn't common practice on this platform. -func setFileReadonly(f string, mode os.FileMode) error { +func setFileReadonly(_ string, _ os.FileMode) error { return nil } diff --git a/internal/feature/testing.go b/internal/feature/testing.go index b796e89b5..bb398fcfa 100644 --- a/internal/feature/testing.go +++ b/internal/feature/testing.go @@ -12,7 +12,7 @@ import ( // ``` // defer TestSetFlag(t, features.Flags, features.ExampleFlag, true)() // ``` -func TestSetFlag(t *testing.T, f *FlagSet, flag FlagName, value bool) func() { +func TestSetFlag(_ *testing.T, f *FlagSet, flag FlagName, value bool) func() { current := f.Enabled(flag) panicIfCalled := func(msg string) { diff --git a/internal/fs/setflags_other.go b/internal/fs/setflags_other.go index 6485126e0..281aef093 100644 --- a/internal/fs/setflags_other.go +++ b/internal/fs/setflags_other.go @@ -7,6 +7,6 @@ import "os" // OS-specific replacements of setFlags can set file status flags // that improve I/O performance. -func setFlags(*os.File) error { +func setFlags(_ *os.File) error { return nil } diff --git a/internal/repository/index/associated_data_test.go b/internal/repository/index/associated_data_test.go index 82dd9908d..3d2c2f0a8 100644 --- a/internal/repository/index/associated_data_test.go +++ b/internal/repository/index/associated_data_test.go @@ -14,7 +14,7 @@ type noopSaver struct{} func (n *noopSaver) Connections() uint { return 2 } -func (n *noopSaver) SaveUnpacked(ctx context.Context, t restic.FileType, buf []byte) (restic.ID, error) { +func (n *noopSaver) SaveUnpacked(_ context.Context, _ restic.FileType, buf []byte) (restic.ID, error) { return restic.Hash(buf), nil } diff --git a/internal/repository/testing.go b/internal/repository/testing.go index a8321faad..5a464e44f 100644 --- a/internal/repository/testing.go +++ b/internal/repository/testing.go @@ -158,7 +158,7 @@ func BenchmarkAllVersions(b *testing.B, bench VersionedBenchmark) { } } -func TestNewLock(t *testing.T, repo *Repository, exclusive bool) (*restic.Lock, error) { +func TestNewLock(_ *testing.T, repo *Repository, exclusive bool) (*restic.Lock, error) { // TODO get rid of this test helper return restic.NewLock(context.TODO(), &internalRepository{repo}, exclusive) } diff --git a/internal/restic/lock_windows.go b/internal/restic/lock_windows.go index ee24e3bca..f38840f9f 100644 --- a/internal/restic/lock_windows.go +++ b/internal/restic/lock_windows.go @@ -8,7 +8,7 @@ import ( ) // uidGidInt always returns 0 on Windows, since uid isn't numbers -func uidGidInt(u *user.User) (uid, gid uint32, err error) { +func uidGidInt(_ *user.User) (uid, gid uint32, err error) { return 0, 0, nil } diff --git a/internal/restorer/filerestorer_test.go b/internal/restorer/filerestorer_test.go index 62d93d64d..67819970a 100644 --- a/internal/restorer/filerestorer_test.go +++ b/internal/restorer/filerestorer_test.go @@ -43,7 +43,7 @@ type TestRepo struct { loader blobsLoaderFn } -func (i *TestRepo) Lookup(tpe restic.BlobType, id restic.ID) []restic.PackedBlob { +func (i *TestRepo) Lookup(_ restic.BlobType, id restic.ID) []restic.PackedBlob { packs := i.blobs[id] return packs } @@ -52,7 +52,7 @@ func (i *TestRepo) fileContent(file *fileInfo) string { return i.filesPathToContent[file.location] } -func (i *TestRepo) StartWarmup(ctx context.Context, packs restic.IDSet) (restic.WarmupJob, error) { +func (i *TestRepo) StartWarmup(_ context.Context, packs restic.IDSet) (restic.WarmupJob, error) { job := TestWarmupJob{handlesCount: len(packs)} i.warmupJobs = append(i.warmupJobs, &job) return &job, nil diff --git a/internal/restorer/restorer_test.go b/internal/restorer/restorer_test.go index e0306ce01..b48ae137c 100644 --- a/internal/restorer/restorer_test.go +++ b/internal/restorer/restorer_test.go @@ -1004,10 +1004,10 @@ type printerMock struct { func (p *printerMock) Update(_ restoreui.State, _ time.Duration) { } -func (p *printerMock) Error(item string, err error) error { +func (p *printerMock) Error(_ string, _ error) error { return nil } -func (p *printerMock) CompleteItem(action restoreui.ItemAction, item string, size uint64) { +func (p *printerMock) CompleteItem(_ restoreui.ItemAction, _ string, _ uint64) { } func (p *printerMock) Finish(s restoreui.State, _ time.Duration) { p.s = s diff --git a/internal/ui/termstatus/background.go b/internal/ui/termstatus/background.go index 4834a460f..d4b918ae7 100644 --- a/internal/ui/termstatus/background.go +++ b/internal/ui/termstatus/background.go @@ -5,6 +5,6 @@ package termstatus // IsProcessBackground reports whether the current process is running in the // background. Not implemented for this platform. -func IsProcessBackground(uintptr) bool { +func IsProcessBackground(_ uintptr) bool { return false }