forked from TrueCloudLab/restic
Replace lots of unused parameters with _
The parameters are required by the implemented function signature or interface.
This commit is contained in:
parent
d1a5ec7839
commit
472bf5184f
19 changed files with 30 additions and 30 deletions
|
@ -1181,7 +1181,7 @@ type emptySaveBackend struct {
|
|||
restic.Backend
|
||||
}
|
||||
|
||||
func (b *emptySaveBackend) Save(ctx context.Context, h restic.Handle, rd restic.RewindReader) error {
|
||||
func (b *emptySaveBackend) Save(ctx context.Context, h restic.Handle, _ restic.RewindReader) error {
|
||||
return b.Backend.Save(ctx, h, restic.NewByteReader([]byte{}, nil))
|
||||
}
|
||||
|
||||
|
@ -2202,7 +2202,7 @@ type writeToOnly struct {
|
|||
rd io.Reader
|
||||
}
|
||||
|
||||
func (r *writeToOnly) Read(p []byte) (n int, err error) {
|
||||
func (r *writeToOnly) Read(_ []byte) (n int, err error) {
|
||||
return 0, fmt.Errorf("should have called WriteTo instead")
|
||||
}
|
||||
|
||||
|
|
|
@ -22,7 +22,7 @@ type saveFail struct {
|
|||
failAt int32
|
||||
}
|
||||
|
||||
func (b *saveFail) SaveBlob(_ context.Context, t restic.BlobType, buf []byte, id restic.ID, storeDuplicates bool) (restic.ID, bool, int, error) {
|
||||
func (b *saveFail) SaveBlob(_ context.Context, _ restic.BlobType, _ []byte, id restic.ID, _ bool) (restic.ID, bool, int, error) {
|
||||
val := atomic.AddInt32(&b.cnt, 1)
|
||||
if val == b.failAt {
|
||||
return restic.ID{}, false, 0, errTest
|
||||
|
|
|
@ -12,7 +12,7 @@ import (
|
|||
"golang.org/x/sync/errgroup"
|
||||
)
|
||||
|
||||
func treeSaveHelper(_ context.Context, t restic.BlobType, buf *Buffer, cb func(res SaveBlobResponse)) {
|
||||
func treeSaveHelper(_ context.Context, _ restic.BlobType, buf *Buffer, cb func(res SaveBlobResponse)) {
|
||||
cb(SaveBlobResponse{
|
||||
id: restic.NewRandomID(),
|
||||
known: false,
|
||||
|
|
|
@ -154,7 +154,7 @@ type mockReader struct {
|
|||
closed bool
|
||||
}
|
||||
|
||||
func (rd *mockReader) Read(p []byte) (n int, err error) {
|
||||
func (rd *mockReader) Read(_ []byte) (n int, err error) {
|
||||
return 0, nil
|
||||
}
|
||||
func (rd *mockReader) Close() error {
|
||||
|
|
|
@ -322,7 +322,7 @@ func (k *Key) Seal(dst, nonce, plaintext, additionalData []byte) []byte {
|
|||
//
|
||||
// Even if the function fails, the contents of dst, up to its capacity,
|
||||
// may be overwritten.
|
||||
func (k *Key) Open(dst, nonce, ciphertext, additionalData []byte) ([]byte, error) {
|
||||
func (k *Key) Open(dst, nonce, ciphertext, _ []byte) ([]byte, error) {
|
||||
if !k.Valid() {
|
||||
return nil, errors.New("invalid key")
|
||||
}
|
||||
|
|
|
@ -35,7 +35,7 @@ var _ FS = &Reader{}
|
|||
|
||||
// VolumeName returns leading volume name, for the Reader file system it's
|
||||
// always the empty string.
|
||||
func (fs *Reader) VolumeName(path string) string {
|
||||
func (fs *Reader) VolumeName(_ string) string {
|
||||
return ""
|
||||
}
|
||||
|
||||
|
@ -76,7 +76,7 @@ func (fs *Reader) fi() os.FileInfo {
|
|||
// (O_RDONLY etc.) and perm, (0666 etc.) if applicable. If successful,
|
||||
// methods on the returned File can be used for I/O.
|
||||
// If there is an error, it will be of type *os.PathError.
|
||||
func (fs *Reader) OpenFile(name string, flag int, perm os.FileMode) (f File, err error) {
|
||||
func (fs *Reader) OpenFile(name string, flag int, _ os.FileMode) (f File, err error) {
|
||||
if flag & ^(O_RDONLY|O_NOFOLLOW) != 0 {
|
||||
return nil, pathError("open", name,
|
||||
fmt.Errorf("invalid combination of flags 0x%x", flag))
|
||||
|
@ -149,7 +149,7 @@ func (fs *Reader) Separator() string {
|
|||
}
|
||||
|
||||
// IsAbs reports whether the path is absolute. For the Reader, this is always the case.
|
||||
func (fs *Reader) IsAbs(p string) bool {
|
||||
func (fs *Reader) IsAbs(_ string) bool {
|
||||
return true
|
||||
}
|
||||
|
||||
|
@ -236,11 +236,11 @@ func (f fakeFile) Fd() uintptr {
|
|||
return 0
|
||||
}
|
||||
|
||||
func (f fakeFile) Readdirnames(n int) ([]string, error) {
|
||||
func (f fakeFile) Readdirnames(_ int) ([]string, error) {
|
||||
return nil, pathError("readdirnames", f.name, os.ErrInvalid)
|
||||
}
|
||||
|
||||
func (f fakeFile) Readdir(n int) ([]os.FileInfo, error) {
|
||||
func (f fakeFile) Readdir(_ int) ([]os.FileInfo, error) {
|
||||
return nil, pathError("readdir", f.name, os.ErrInvalid)
|
||||
}
|
||||
|
||||
|
@ -248,7 +248,7 @@ func (f fakeFile) Seek(int64, int) (int64, error) {
|
|||
return 0, pathError("seek", f.name, os.ErrInvalid)
|
||||
}
|
||||
|
||||
func (f fakeFile) Read(p []byte) (int, error) {
|
||||
func (f fakeFile) Read(_ []byte) (int, error) {
|
||||
return 0, pathError("read", f.name, os.ErrInvalid)
|
||||
}
|
||||
|
||||
|
|
|
@ -34,7 +34,7 @@ func HasSufficientPrivilegesForVSS() error {
|
|||
// NewVssSnapshot creates a new vss snapshot. If creating the snapshots doesn't
|
||||
// finish within the timeout an error is returned.
|
||||
func NewVssSnapshot(
|
||||
volume string, timeoutInSeconds uint, msgError ErrorHandler) (VssSnapshot, error) {
|
||||
_ string, _ uint, _ ErrorHandler) (VssSnapshot, error) {
|
||||
return VssSnapshot{}, errors.New("VSS snapshots are only supported on windows")
|
||||
}
|
||||
|
||||
|
|
|
@ -66,7 +66,7 @@ func (f *file) Attr(_ context.Context, a *fuse.Attr) error {
|
|||
|
||||
}
|
||||
|
||||
func (f *file) Open(_ context.Context, req *fuse.OpenRequest, resp *fuse.OpenResponse) (fs.Handle, error) {
|
||||
func (f *file) Open(_ context.Context, _ *fuse.OpenRequest, _ *fuse.OpenResponse) (fs.Handle, error) {
|
||||
debug.Log("open file %v with %d blobs", f.node.Name, len(f.node.Content))
|
||||
|
||||
var bytes uint64
|
||||
|
|
|
@ -24,7 +24,7 @@ func newLink(root *Root, inode uint64, node *restic.Node) (*link, error) {
|
|||
return &link{root: root, inode: inode, node: node}, nil
|
||||
}
|
||||
|
||||
func (l *link) Readlink(_ context.Context, req *fuse.ReadlinkRequest) (string, error) {
|
||||
func (l *link) Readlink(_ context.Context, _ *fuse.ReadlinkRequest) (string, error) {
|
||||
return l.node.LinkTarget, nil
|
||||
}
|
||||
|
||||
|
|
|
@ -20,7 +20,7 @@ func newOther(root *Root, inode uint64, node *restic.Node) (*other, error) {
|
|||
return &other{root: root, inode: inode, node: node}, nil
|
||||
}
|
||||
|
||||
func (l *other) Readlink(_ context.Context, req *fuse.ReadlinkRequest) (string, error) {
|
||||
func (l *other) Readlink(_ context.Context, _ *fuse.ReadlinkRequest) (string, error) {
|
||||
return l.node.LinkTarget, nil
|
||||
}
|
||||
|
||||
|
|
|
@ -134,7 +134,7 @@ func newSnapshotLink(root *Root, inode uint64, target string, snapshot *restic.S
|
|||
}
|
||||
|
||||
// Readlink
|
||||
func (l *snapshotLink) Readlink(_ context.Context, req *fuse.ReadlinkRequest) (string, error) {
|
||||
func (l *snapshotLink) Readlink(_ context.Context, _ *fuse.ReadlinkRequest) (string, error) {
|
||||
return l.target, nil
|
||||
}
|
||||
|
||||
|
|
|
@ -166,7 +166,7 @@ func (r ForbiddenRepo) LoadBlob(context.Context, restic.BlobType, restic.ID, []b
|
|||
return nil, errors.New("should not be called")
|
||||
}
|
||||
|
||||
func (r ForbiddenRepo) LookupBlobSize(id restic.ID, tpe restic.BlobType) (uint, bool) {
|
||||
func (r ForbiddenRepo) LookupBlobSize(_ restic.ID, _ restic.BlobType) (uint, bool) {
|
||||
return 0, false
|
||||
}
|
||||
|
||||
|
|
|
@ -136,7 +136,7 @@ func y(d time.Time, _ int) int {
|
|||
}
|
||||
|
||||
// always returns a unique number for d.
|
||||
func always(d time.Time, nr int) int {
|
||||
func always(_ time.Time, nr int) int {
|
||||
return nr
|
||||
}
|
||||
|
||||
|
|
|
@ -73,9 +73,9 @@ type printerMock struct {
|
|||
filesFinished, filesTotal, allBytesWritten, allBytesTotal uint64
|
||||
}
|
||||
|
||||
func (p *printerMock) Update(filesFinished, filesTotal, allBytesWritten, allBytesTotal uint64, duration time.Duration) {
|
||||
func (p *printerMock) Update(_, _, _, _ uint64, _ time.Duration) {
|
||||
}
|
||||
func (p *printerMock) Finish(filesFinished, filesTotal, allBytesWritten, allBytesTotal uint64, duration time.Duration) {
|
||||
func (p *printerMock) Finish(filesFinished, filesTotal, allBytesWritten, allBytesTotal uint64, _ time.Duration) {
|
||||
p.filesFinished = filesFinished
|
||||
p.filesTotal = filesTotal
|
||||
p.allBytesWritten = allBytesWritten
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
package selfupdate
|
||||
|
||||
// Remove the target binary.
|
||||
func removeResticBinary(dir, target string) error {
|
||||
func removeResticBinary(_, _ string) error {
|
||||
// removed on rename on this platform
|
||||
return nil
|
||||
}
|
||||
|
|
|
@ -72,13 +72,13 @@ func (b *TextProgress) Update(total, processed Counter, errors uint, currentFile
|
|||
|
||||
// ScannerError is the error callback function for the scanner, it prints the
|
||||
// error in verbose mode and returns nil.
|
||||
func (b *TextProgress) ScannerError(item string, err error) error {
|
||||
func (b *TextProgress) ScannerError(_ string, err error) error {
|
||||
b.V("scan: %v\n", err)
|
||||
return nil
|
||||
}
|
||||
|
||||
// Error is the error callback function for the archiver, it prints the error and returns nil.
|
||||
func (b *TextProgress) Error(item string, err error) error {
|
||||
func (b *TextProgress) Error(_ string, err error) error {
|
||||
b.E("error: %v\n", err)
|
||||
return nil
|
||||
}
|
||||
|
@ -126,7 +126,7 @@ func (b *TextProgress) Reset() {
|
|||
}
|
||||
|
||||
// Finish prints the finishing messages.
|
||||
func (b *TextProgress) Finish(snapshotID restic.ID, start time.Time, summary *Summary, dryRun bool) {
|
||||
func (b *TextProgress) Finish(_ restic.ID, start time.Time, summary *Summary, dryRun bool) {
|
||||
b.P("\n")
|
||||
b.P("Files: %5d new, %5d changed, %5d unmodified\n", summary.Files.New, summary.Files.Changed, summary.Files.Unchanged)
|
||||
b.P("Dirs: %5d new, %5d changed, %5d unmodified\n", summary.Dirs.New, summary.Dirs.Changed, summary.Dirs.Unchanged)
|
||||
|
|
|
@ -25,7 +25,7 @@ const mockFinishDuration = 42 * time.Second
|
|||
func (p *mockPrinter) Update(filesFinished, filesTotal, allBytesWritten, allBytesTotal uint64, duration time.Duration) {
|
||||
p.trace = append(p.trace, printerTraceEntry{filesFinished, filesTotal, allBytesWritten, allBytesTotal, duration, false})
|
||||
}
|
||||
func (p *mockPrinter) Finish(filesFinished, filesTotal, allBytesWritten, allBytesTotal uint64, duration time.Duration) {
|
||||
func (p *mockPrinter) Finish(filesFinished, filesTotal, allBytesWritten, allBytesTotal uint64, _ time.Duration) {
|
||||
p.trace = append(p.trace, printerTraceEntry{filesFinished, filesTotal, allBytesWritten, allBytesTotal, mockFinishDuration, true})
|
||||
}
|
||||
|
||||
|
|
|
@ -15,7 +15,7 @@ const (
|
|||
|
||||
// posixClearCurrentLine removes all characters from the current line and resets the
|
||||
// cursor position to the first column.
|
||||
func posixClearCurrentLine(wr io.Writer, fd uintptr) {
|
||||
func posixClearCurrentLine(wr io.Writer, _ uintptr) {
|
||||
// clear current line
|
||||
_, err := wr.Write([]byte(posixControlMoveCursorHome + posixControlClearLine))
|
||||
if err != nil {
|
||||
|
@ -25,7 +25,7 @@ func posixClearCurrentLine(wr io.Writer, fd uintptr) {
|
|||
}
|
||||
|
||||
// posixMoveCursorUp moves the cursor to the line n lines above the current one.
|
||||
func posixMoveCursorUp(wr io.Writer, fd uintptr, n int) {
|
||||
func posixMoveCursorUp(wr io.Writer, _ uintptr, n int) {
|
||||
data := []byte(posixControlMoveCursorHome)
|
||||
data = append(data, bytes.Repeat([]byte(posixControlMoveCursorUp), n)...)
|
||||
_, err := wr.Write(data)
|
||||
|
|
|
@ -45,7 +45,7 @@ var (
|
|||
|
||||
// windowsClearCurrentLine removes all characters from the current line and
|
||||
// resets the cursor position to the first column.
|
||||
func windowsClearCurrentLine(wr io.Writer, fd uintptr) {
|
||||
func windowsClearCurrentLine(_ io.Writer, fd uintptr) {
|
||||
var info windows.ConsoleScreenBufferInfo
|
||||
windows.GetConsoleScreenBufferInfo(windows.Handle(fd), &info)
|
||||
|
||||
|
@ -61,7 +61,7 @@ func windowsClearCurrentLine(wr io.Writer, fd uintptr) {
|
|||
}
|
||||
|
||||
// windowsMoveCursorUp moves the cursor to the line n lines above the current one.
|
||||
func windowsMoveCursorUp(wr io.Writer, fd uintptr, n int) {
|
||||
func windowsMoveCursorUp(_ io.Writer, fd uintptr, n int) {
|
||||
var info windows.ConsoleScreenBufferInfo
|
||||
windows.GetConsoleScreenBufferInfo(windows.Handle(fd), &info)
|
||||
|
||||
|
|
Loading…
Reference in a new issue