build: fix govet lint errors with golangci-lint v1.60.1

There were a lot of instances of this lint error

    printf: non-constant format string in call to github.com/rclone/rclone/fs.Logf (govet)

Which were fixed by re-arranging the arguments and adding "%s".

There were quite a few genuine bugs which were found too.
This commit is contained in:
Nick Craig-Wood
2024-08-14 18:19:36 +01:00
parent 83613634f9
commit 61b27cda80
12 changed files with 27 additions and 17 deletions

View File

@ -12,14 +12,25 @@ type logger struct{}
// print log message
func (l logger) Print(level gofakes3.LogLevel, v ...interface{}) {
var s string
if len(v) == 0 {
s = ""
} else {
var ok bool
s, ok = v[0].(string)
if !ok {
s = fmt.Sprint(v[0])
}
v = v[1:]
}
switch level {
default:
fallthrough
case gofakes3.LogErr:
fs.Errorf("serve s3", fmt.Sprintln(v...))
fs.Errorf("serve s3", s, v...)
case gofakes3.LogWarn:
fs.Infof("serve s3", fmt.Sprintln(v...))
fs.Infof("serve s3", s, v...)
case gofakes3.LogInfo:
fs.Debugf("serve s3", fmt.Sprintln(v...))
fs.Debugf("serve s3", s, v...)
}
}

View File

@ -3,7 +3,6 @@ package s3
import (
"context"
"encoding/hex"
"fmt"
"io"
"os"
"path"
@ -127,7 +126,7 @@ func authlistResolver(list []string) map[string]string {
for _, v := range list {
parts := strings.Split(v, ",")
if len(parts) != 2 {
fs.Infof(nil, fmt.Sprintf("Ignored: invalid auth pair %s", v))
fs.Infof(nil, "Ignored: invalid auth pair %s", v)
continue
}
authList[parts[0]] = parts[1]