mirror of
https://github.com/rclone/rclone.git
synced 2025-08-16 08:38:11 +02:00
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:
@ -116,7 +116,7 @@ func newFsFileAddFilter(remote string) (fs.Fs, string) {
|
||||
if !fi.InActive() {
|
||||
err := fmt.Errorf("can't limit to single files when using filters: %v", remote)
|
||||
err = fs.CountError(err)
|
||||
log.Fatalf(err.Error())
|
||||
log.Fatal(err.Error())
|
||||
}
|
||||
// Limit transfers to this file
|
||||
err := fi.AddFile(fileName)
|
||||
|
@ -104,7 +104,7 @@ func cryptCheck(ctx context.Context, fdst, fsrc fs.Fs) error {
|
||||
}
|
||||
if cryptHash != underlyingHash {
|
||||
err = fmt.Errorf("hashes differ (%s:%s) %q vs (%s:%s) %q", fdst.Name(), fdst.Root(), cryptHash, fsrc.Name(), fsrc.Root(), underlyingHash)
|
||||
fs.Errorf(src, err.Error())
|
||||
fs.Errorf(src, "%s", err.Error())
|
||||
return true, false, nil
|
||||
}
|
||||
return false, false, nil
|
||||
|
@ -243,13 +243,13 @@ func (cds *contentDirectoryService) Handle(action string, argsXML []byte, r *htt
|
||||
}
|
||||
obj, err := cds.objectFromID(browse.ObjectID)
|
||||
if err != nil {
|
||||
return nil, upnp.Errorf(upnpav.NoSuchObjectErrorCode, err.Error())
|
||||
return nil, upnp.Errorf(upnpav.NoSuchObjectErrorCode, "%s", err.Error())
|
||||
}
|
||||
switch browse.BrowseFlag {
|
||||
case "BrowseDirectChildren":
|
||||
objs, err := cds.readContainer(obj, host)
|
||||
if err != nil {
|
||||
return nil, upnp.Errorf(upnpav.NoSuchObjectErrorCode, err.Error())
|
||||
return nil, upnp.Errorf(upnpav.NoSuchObjectErrorCode, "%s", err.Error())
|
||||
}
|
||||
totalMatches := len(objs)
|
||||
objs = objs[func() (low int) {
|
||||
|
@ -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...)
|
||||
}
|
||||
}
|
||||
|
@ -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]
|
||||
|
Reference in New Issue
Block a user