Merge pull request #5122 from restic/bump-golangci-lint

Bump go and golangci lint version
This commit is contained in:
Michael Eischer
2024-11-03 21:34:25 +01:00
committed by GitHub
16 changed files with 125 additions and 101 deletions
+1 -1
View File
@@ -106,7 +106,7 @@ func runRESTServer(ctx context.Context, t testing.TB, dir, reqListenAddr string)
matched = true
}
}
fmt.Fprintln(os.Stdout, line) // print all output to console
_, _ = fmt.Fprintln(os.Stdout, line) // print all output to console
}
}()
+1 -1
View File
@@ -120,7 +120,7 @@ func goroutineNum() int {
runtime.Stack(b, false)
var num int
fmt.Sscanf(string(b), "goroutine %d ", &num)
_, _ = fmt.Sscanf(string(b), "goroutine %d ", &num)
return num
}
+1 -1
View File
@@ -42,7 +42,7 @@ func (rd *eofDetectReader) Close() error {
msg += fmt.Sprintf(", body: %q", buf)
}
fmt.Fprintln(os.Stderr, msg)
_, _ = fmt.Fprintln(os.Stderr, msg)
Log("%s: %+v", msg, errors.New("Close()"))
}
return rd.rd.Close()
+6 -4
View File
@@ -212,7 +212,7 @@ func (t *Terminal) runWithoutStatus(ctx context.Context) {
}
if _, err := io.WriteString(dst, msg.line); err != nil {
fmt.Fprintf(os.Stderr, "write failed: %v\n", err)
_, _ = fmt.Fprintf(os.Stderr, "write failed: %v\n", err)
}
if flush == nil {
@@ -220,16 +220,18 @@ func (t *Terminal) runWithoutStatus(ctx context.Context) {
}
if err := flush(); err != nil {
fmt.Fprintf(os.Stderr, "flush failed: %v\n", err)
_, _ = fmt.Fprintf(os.Stderr, "flush failed: %v\n", err)
}
case stat := <-t.status:
for _, line := range stat.lines {
// Ensure that each message ends with exactly one newline.
fmt.Fprintln(t.wr, strings.TrimRight(line, "\n"))
if _, err := fmt.Fprintln(t.wr, strings.TrimRight(line, "\n")); err != nil {
_, _ = fmt.Fprintf(os.Stderr, "write failed: %v\n", err)
}
}
if err := t.wr.Flush(); err != nil {
fmt.Fprintf(os.Stderr, "flush failed: %v\n", err)
_, _ = fmt.Fprintf(os.Stderr, "flush failed: %v\n", err)
}
}
}
+2 -2
View File
@@ -28,7 +28,7 @@ type WalkVisitor struct {
// was returned. This function is mandatory
ProcessNode WalkFunc
// Optional callback
LeaveDir func(path string)
LeaveDir func(path string) error
}
// Walk calls walkFn recursively for each node in root. If walkFn returns an
@@ -100,7 +100,7 @@ func walk(ctx context.Context, repo restic.BlobLoader, prefix string, parentTree
}
if visitor.LeaveDir != nil {
visitor.LeaveDir(prefix)
return visitor.LeaveDir(prefix)
}
return nil
+8 -8
View File
@@ -93,12 +93,12 @@ func (t TreeMap) Connections() uint {
// checkFunc returns a function suitable for walking the tree to check
// something, and a function which will check the final result.
type checkFunc func(t testing.TB) (walker WalkFunc, leaveDir func(path string), final func(testing.TB))
type checkFunc func(t testing.TB) (walker WalkFunc, leaveDir func(path string) error, final func(testing.TB))
// checkItemOrder ensures that the order of the 'path' arguments is the one passed in as 'want'.
func checkItemOrder(want []string) checkFunc {
pos := 0
return func(t testing.TB) (walker WalkFunc, leaveDir func(path string), final func(testing.TB)) {
return func(t testing.TB) (walker WalkFunc, leaveDir func(path string) error, final func(testing.TB)) {
walker = func(treeID restic.ID, path string, node *restic.Node, err error) error {
if err != nil {
t.Errorf("error walking %v: %v", path, err)
@@ -117,8 +117,8 @@ func checkItemOrder(want []string) checkFunc {
return nil
}
leaveDir = func(path string) {
_ = walker(restic.ID{}, "leave: "+path, nil, nil)
leaveDir = func(path string) error {
return walker(restic.ID{}, "leave: "+path, nil, nil)
}
final = func(t testing.TB) {
@@ -134,7 +134,7 @@ func checkItemOrder(want []string) checkFunc {
// checkParentTreeOrder ensures that the order of the 'parentID' arguments is the one passed in as 'want'.
func checkParentTreeOrder(want []string) checkFunc {
pos := 0
return func(t testing.TB) (walker WalkFunc, leaveDir func(path string), final func(testing.TB)) {
return func(t testing.TB) (walker WalkFunc, leaveDir func(path string) error, final func(testing.TB)) {
walker = func(treeID restic.ID, path string, node *restic.Node, err error) error {
if err != nil {
t.Errorf("error walking %v: %v", path, err)
@@ -168,7 +168,7 @@ func checkParentTreeOrder(want []string) checkFunc {
func checkSkipFor(skipFor map[string]struct{}, wantPaths []string) checkFunc {
var pos int
return func(t testing.TB) (walker WalkFunc, leaveDir func(path string), final func(testing.TB)) {
return func(t testing.TB) (walker WalkFunc, leaveDir func(path string) error, final func(testing.TB)) {
walker = func(treeID restic.ID, path string, node *restic.Node, err error) error {
if err != nil {
t.Errorf("error walking %v: %v", path, err)
@@ -192,8 +192,8 @@ func checkSkipFor(skipFor map[string]struct{}, wantPaths []string) checkFunc {
return nil
}
leaveDir = func(path string) {
_ = walker(restic.ID{}, "leave: "+path, nil, nil)
leaveDir = func(path string) error {
return walker(restic.ID{}, "leave: "+path, nil, nil)
}
final = func(t testing.TB) {