Rename unused parameters to '_'.

This commit is contained in:
Martin Smith 2025-02-28 19:52:43 +00:00
parent 63888940e0
commit 44bf8dc582
12 changed files with 17 additions and 17 deletions

View File

@ -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)
}

View File

@ -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
}

View File

@ -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)) {

View File

@ -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
}

View File

@ -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) {

View File

@ -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
}

View File

@ -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
}

View File

@ -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)
}

View File

@ -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
}

View File

@ -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

View File

@ -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

View File

@ -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
}