mirror of
https://github.com/restic/restic.git
synced 2025-12-04 03:22:23 +00:00
Merge pull request #3683 from MichaelEischer/fix-golangci-lint-warnings
Fix golangci lint warnings
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
//go:build !windows
|
||||
// +build !windows
|
||||
|
||||
package archiver
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
//go:build windows
|
||||
// +build windows
|
||||
|
||||
package archiver
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
//go:build aix || solaris
|
||||
// +build aix solaris
|
||||
|
||||
package backend
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
//go:build !windows
|
||||
// +build !windows
|
||||
|
||||
package backend_test
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
//go:build !aix && !solaris && !windows
|
||||
// +build !aix,!solaris,!windows
|
||||
|
||||
package backend
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
//go:build !windows
|
||||
// +build !windows
|
||||
|
||||
package local
|
||||
|
||||
@@ -22,7 +22,7 @@ type Cache struct {
|
||||
free, size int // Current and max capacity, in bytes.
|
||||
}
|
||||
|
||||
// Construct a blob cache that stores at most size bytes worth of blobs.
|
||||
// New constructs a blob cache that stores at most size bytes worth of blobs.
|
||||
func New(size int) *Cache {
|
||||
c := &Cache{
|
||||
free: size,
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
//go:build debug
|
||||
// +build debug
|
||||
|
||||
package debug
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
//go:build !debug
|
||||
// +build !debug
|
||||
|
||||
package debug
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
//go:build debug
|
||||
// +build debug
|
||||
|
||||
package debug
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
//go:build !debug
|
||||
// +build !debug
|
||||
|
||||
package debug
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
//go:build debug
|
||||
// +build debug
|
||||
|
||||
package debug
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
//go:build !debug
|
||||
// +build !debug
|
||||
|
||||
package debug
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
//go:build !windows
|
||||
// +build !windows
|
||||
|
||||
package fs
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
//go:build windows
|
||||
// +build windows
|
||||
|
||||
package fs
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
//go:build !windows
|
||||
// +build !windows
|
||||
|
||||
package fs
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
//go:build windows
|
||||
// +build windows
|
||||
|
||||
package fs
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
//go:build !windows
|
||||
// +build !windows
|
||||
|
||||
package fs
|
||||
|
||||
@@ -117,7 +117,7 @@ func (fs *LocalVss) snapshotPath(path string) string {
|
||||
fs.msgMessage("creating VSS snapshot for [%s]\n", vssVolume)
|
||||
|
||||
if snapshot, err := NewVssSnapshot(vssVolume, 120, fs.msgError); err != nil {
|
||||
_ = fs.msgError(vssVolume, errors.Errorf("failed to create snapshot for [%s]: %s\n",
|
||||
_ = fs.msgError(vssVolume, errors.Errorf("failed to create snapshot for [%s]: %s",
|
||||
vssVolume, err))
|
||||
fs.failedSnapshots[volumeNameLower] = struct{}{}
|
||||
} else {
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
//go:build freebsd || darwin || netbsd
|
||||
// +build freebsd darwin netbsd
|
||||
|
||||
package fs
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
//go:build !windows && !darwin && !freebsd && !netbsd
|
||||
// +build !windows,!darwin,!freebsd,!netbsd
|
||||
|
||||
package fs
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
//go:build windows
|
||||
// +build windows
|
||||
|
||||
package fs
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
//go:build !windows
|
||||
// +build !windows
|
||||
|
||||
package fs
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
//go:build windows
|
||||
// +build windows
|
||||
|
||||
package fs
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
//go:build darwin || freebsd || linux
|
||||
// +build darwin freebsd linux
|
||||
|
||||
package fuse
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
//go:build darwin || freebsd || linux
|
||||
// +build darwin freebsd linux
|
||||
|
||||
package fuse
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
//go:build darwin || freebsd || linux
|
||||
// +build darwin freebsd linux
|
||||
|
||||
package fuse
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
//go:build darwin || freebsd || linux
|
||||
// +build darwin freebsd linux
|
||||
|
||||
package fuse
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
//go:build darwin || freebsd || linux
|
||||
// +build darwin freebsd linux
|
||||
|
||||
package fuse
|
||||
|
||||
@@ -56,7 +56,7 @@ func TestRoundTripperReader(t *testing.T) {
|
||||
_, err := io.ReadFull(rand.Reader, data)
|
||||
test.OK(t, err)
|
||||
|
||||
var send *tracedReadCloser = newTracedReadCloser(bytes.NewReader(data))
|
||||
send := newTracedReadCloser(bytes.NewReader(data))
|
||||
var recv *tracedReadCloser
|
||||
|
||||
rt := limiter.Transport(roundTripper(func(req *http.Request) (*http.Response, error) {
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
//go:build !windows
|
||||
// +build !windows
|
||||
|
||||
package restic
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
//go:build !freebsd && !windows
|
||||
// +build !freebsd,!windows
|
||||
|
||||
package restic
|
||||
|
||||
@@ -166,7 +166,7 @@ func (node *Node) CreateAt(ctx context.Context, path string, repo Repository) er
|
||||
case "socket":
|
||||
return nil
|
||||
default:
|
||||
return errors.Errorf("filetype %q not implemented!\n", node.Type)
|
||||
return errors.Errorf("filetype %q not implemented", node.Type)
|
||||
}
|
||||
|
||||
return nil
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
//go:build aix
|
||||
// +build aix
|
||||
|
||||
package restic
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
//go:build freebsd
|
||||
// +build freebsd
|
||||
|
||||
package restic
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
//go:build !windows
|
||||
// +build !windows
|
||||
|
||||
package restic
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
//go:build !windows
|
||||
// +build !windows
|
||||
|
||||
package restic
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
//go:build !linux && !darwin
|
||||
// +build !linux,!darwin
|
||||
|
||||
package restorer
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
//+build !windows
|
||||
//go:build !windows
|
||||
// +build !windows
|
||||
|
||||
package restorer
|
||||
|
||||
|
||||
@@ -61,7 +61,7 @@ func TestCounter(t *testing.T) {
|
||||
|
||||
func TestCounterNil(t *testing.T) {
|
||||
// Shouldn't panic.
|
||||
var c *progress.Counter = nil
|
||||
var c *progress.Counter
|
||||
c.Add(1)
|
||||
c.Done()
|
||||
}
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
//go:build darwin || dragonfly || freebsd || netbsd || openbsd
|
||||
// +build darwin dragonfly freebsd netbsd openbsd
|
||||
|
||||
package signals
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
//go:build aix || linux || solaris
|
||||
// +build aix linux solaris
|
||||
|
||||
package signals
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
//go:build !linux
|
||||
// +build !linux
|
||||
|
||||
package termstatus
|
||||
|
||||
@@ -10,7 +10,7 @@ import (
|
||||
"strings"
|
||||
"unicode"
|
||||
|
||||
"golang.org/x/crypto/ssh/terminal"
|
||||
"golang.org/x/term"
|
||||
"golang.org/x/text/width"
|
||||
)
|
||||
|
||||
@@ -321,7 +321,7 @@ func (t *Terminal) SetStatus(lines []string) {
|
||||
var width int
|
||||
if t.canUpdateStatus {
|
||||
var err error
|
||||
width, _, err = terminal.GetSize(int(t.fd))
|
||||
width, _, err = term.GetSize(int(t.fd))
|
||||
if err != nil || width <= 0 {
|
||||
// use 80 columns by default
|
||||
width = 80
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
//go:build !windows
|
||||
// +build !windows
|
||||
|
||||
package termstatus
|
||||
@@ -6,7 +7,7 @@ import (
|
||||
"io"
|
||||
"os"
|
||||
|
||||
"golang.org/x/crypto/ssh/terminal"
|
||||
"golang.org/x/term"
|
||||
)
|
||||
|
||||
// clearCurrentLine removes all characters from the current line and resets the
|
||||
@@ -23,7 +24,7 @@ func moveCursorUp(wr io.Writer, fd uintptr) func(io.Writer, uintptr, int) {
|
||||
// CanUpdateStatus returns true if status lines can be printed, the process
|
||||
// output is not redirected to a file or pipe.
|
||||
func CanUpdateStatus(fd uintptr) bool {
|
||||
if !terminal.IsTerminal(int(fd)) {
|
||||
if !term.IsTerminal(int(fd)) {
|
||||
return false
|
||||
}
|
||||
term := os.Getenv("TERM")
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
//go:build windows
|
||||
// +build windows
|
||||
|
||||
package termstatus
|
||||
|
||||
Reference in New Issue
Block a user