Merge pull request #3683 from MichaelEischer/fix-golangci-lint-warnings

Fix golangci lint warnings
This commit is contained in:
Alexander Neumann
2022-03-29 11:45:10 +02:00
committed by GitHub
56 changed files with 72 additions and 24 deletions

View File

@@ -1,3 +1,4 @@
//go:build !windows
// +build !windows
package archiver

View File

@@ -1,3 +1,4 @@
//go:build windows
// +build windows
package archiver

View File

@@ -1,3 +1,4 @@
//go:build aix || solaris
// +build aix solaris
package backend

View File

@@ -1,3 +1,4 @@
//go:build !windows
// +build !windows
package backend_test

View File

@@ -1,3 +1,4 @@
//go:build !aix && !solaris && !windows
// +build !aix,!solaris,!windows
package backend

View File

@@ -1,3 +1,4 @@
//go:build !windows
// +build !windows
package local

View File

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

View File

@@ -1,3 +1,4 @@
//go:build debug
// +build debug
package debug

View File

@@ -1,3 +1,4 @@
//go:build !debug
// +build !debug
package debug

View File

@@ -1,3 +1,4 @@
//go:build debug
// +build debug
package debug

View File

@@ -1,3 +1,4 @@
//go:build !debug
// +build !debug
package debug

View File

@@ -1,3 +1,4 @@
//go:build debug
// +build debug
package debug

View File

@@ -1,3 +1,4 @@
//go:build !debug
// +build !debug
package debug

View File

@@ -1,3 +1,4 @@
//go:build !windows
// +build !windows
package fs

View File

@@ -1,3 +1,4 @@
//go:build windows
// +build windows
package fs

View File

@@ -1,3 +1,4 @@
//go:build !windows
// +build !windows
package fs

View File

@@ -1,3 +1,4 @@
//go:build windows
// +build windows
package fs

View File

@@ -1,3 +1,4 @@
//go:build !windows
// +build !windows
package fs

View File

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

View File

@@ -1,3 +1,4 @@
//go:build freebsd || darwin || netbsd
// +build freebsd darwin netbsd
package fs

View File

@@ -1,3 +1,4 @@
//go:build !windows && !darwin && !freebsd && !netbsd
// +build !windows,!darwin,!freebsd,!netbsd
package fs

View File

@@ -1,3 +1,4 @@
//go:build windows
// +build windows
package fs

View File

@@ -1,3 +1,4 @@
//go:build !windows
// +build !windows
package fs

View File

@@ -1,3 +1,4 @@
//go:build windows
// +build windows
package fs

View File

@@ -1,3 +1,4 @@
//go:build darwin || freebsd || linux
// +build darwin freebsd linux
package fuse

View File

@@ -1,3 +1,4 @@
//go:build darwin || freebsd || linux
// +build darwin freebsd linux
package fuse

View File

@@ -1,3 +1,4 @@
//go:build darwin || freebsd || linux
// +build darwin freebsd linux
package fuse

View File

@@ -1,3 +1,4 @@
//go:build darwin || freebsd || linux
// +build darwin freebsd linux
package fuse

View File

@@ -1,3 +1,4 @@
//go:build darwin || freebsd || linux
// +build darwin freebsd linux
package fuse

View File

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

View File

@@ -1,3 +1,4 @@
//go:build !windows
// +build !windows
package restic

View File

@@ -1,3 +1,4 @@
//go:build !freebsd && !windows
// +build !freebsd,!windows
package restic

View File

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

View File

@@ -1,3 +1,4 @@
//go:build aix
// +build aix
package restic

View File

@@ -1,3 +1,4 @@
//go:build freebsd
// +build freebsd
package restic

View File

@@ -1,3 +1,4 @@
//go:build !windows
// +build !windows
package restic

View File

@@ -1,3 +1,4 @@
//go:build !windows
// +build !windows
package restic

View File

@@ -1,3 +1,4 @@
//go:build !linux && !darwin
// +build !linux,!darwin
package restorer

View File

@@ -1,4 +1,5 @@
//+build !windows
//go:build !windows
// +build !windows
package restorer

View File

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

View File

@@ -1,3 +1,4 @@
//go:build darwin || dragonfly || freebsd || netbsd || openbsd
// +build darwin dragonfly freebsd netbsd openbsd
package signals

View File

@@ -1,3 +1,4 @@
//go:build aix || linux || solaris
// +build aix linux solaris
package signals

View File

@@ -1,3 +1,4 @@
//go:build !linux
// +build !linux
package termstatus

View File

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

View File

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

View File

@@ -1,3 +1,4 @@
//go:build windows
// +build windows
package termstatus