diff --git a/backend/onedrive/onedrive.go b/backend/onedrive/onedrive.go index abdffdf1c..6aad7d177 100644 --- a/backend/onedrive/onedrive.go +++ b/backend/onedrive/onedrive.go @@ -1927,7 +1927,7 @@ func (f *Fs) PublicLink(ctx context.Context, remote string, expire fs.Duration, return shareURL, nil } - cnvFailMsg := "Don't know how to convert share link to direct link - returning the link as is" + const cnvFailMsg = "Don't know how to convert share link to direct link - returning the link as is" directURL := "" segments := strings.Split(shareURL, "/") switch f.driveType { diff --git a/backend/webdav/webdav.go b/backend/webdav/webdav.go index 587ae0fa5..4611e3370 100644 --- a/backend/webdav/webdav.go +++ b/backend/webdav/webdav.go @@ -635,7 +635,7 @@ func (f *Fs) setQuirks(ctx context.Context, vendor string) error { odrvcookie.NewRenew(12*time.Hour, func() { spCookies, err := spCk.Cookies(ctx) if err != nil { - fs.Errorf("could not renew cookies: %s", err.Error()) + fs.Errorf(nil, "could not renew cookies: %s", err.Error()) return } f.srv.SetCookie(&spCookies.FedAuth, &spCookies.RtFa) diff --git a/cmd/cmd.go b/cmd/cmd.go index c8695b292..2aca5341d 100644 --- a/cmd/cmd.go +++ b/cmd/cmd.go @@ -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) diff --git a/cmd/cryptcheck/cryptcheck.go b/cmd/cryptcheck/cryptcheck.go index e26e1b89e..0fac5e136 100644 --- a/cmd/cryptcheck/cryptcheck.go +++ b/cmd/cryptcheck/cryptcheck.go @@ -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 diff --git a/cmd/serve/dlna/cds.go b/cmd/serve/dlna/cds.go index 06d8824a4..98ad42799 100644 --- a/cmd/serve/dlna/cds.go +++ b/cmd/serve/dlna/cds.go @@ -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) { diff --git a/cmd/serve/s3/logger.go b/cmd/serve/s3/logger.go index c96865edc..4638d6e91 100644 --- a/cmd/serve/s3/logger.go +++ b/cmd/serve/s3/logger.go @@ -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...) } } diff --git a/cmd/serve/s3/utils.go b/cmd/serve/s3/utils.go index cb861d3f1..53f79908b 100644 --- a/cmd/serve/s3/utils.go +++ b/cmd/serve/s3/utils.go @@ -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] diff --git a/cmdtest/cmdtest_test.go b/cmdtest/cmdtest_test.go index f77ce9d93..659838959 100644 --- a/cmdtest/cmdtest_test.go +++ b/cmdtest/cmdtest_test.go @@ -154,7 +154,7 @@ func TestCmdTest(t *testing.T) { // Test simple call and output from rclone out, err := rclone("version") - t.Logf("rclone version\n" + out) + t.Log("rclone version\n" + out) if assert.NoError(t, err) { assert.Contains(t, out, "rclone v") assert.Contains(t, out, "version: ") @@ -208,7 +208,7 @@ func TestCmdTest(t *testing.T) { // Test access to config file and simple test data out, err = rclone("lsl", "myLocal:"+testFolder) - t.Logf("rclone lsl myLocal:testFolder\n" + out) + t.Log("rclone lsl myLocal:testFolder\n" + out) if assert.NoError(t, err) { assert.Contains(t, out, "rclone.config") assert.Contains(t, out, "testdata/folderA/fileA1.txt") diff --git a/fs/operations/operations.go b/fs/operations/operations.go index 5ec8c4c1a..2a25bbc23 100644 --- a/fs/operations/operations.go +++ b/fs/operations/operations.go @@ -568,7 +568,7 @@ func DeleteFileWithBackupDir(ctx context.Context, dst fs.Object, backupDir fs.Fs fs.Errorf(dst, "Couldn't %s: %v", action, err) err = fs.CountError(err) } else if !skip { - fs.Infof(dst, actioned) + fs.Infof(dst, "%s", actioned) } return err } diff --git a/fs/rc/internal.go b/fs/rc/internal.go index e2f439a29..36387806f 100644 --- a/fs/rc/internal.go +++ b/fs/rc/internal.go @@ -507,7 +507,7 @@ func rcRunCommand(ctx context.Context, in Params) (out Params, err error) { var httpResponse http.ResponseWriter httpResponse, err = in.GetHTTPResponseWriter() if err != nil { - return nil, fmt.Errorf("response object is required\n" + err.Error()) + return nil, fmt.Errorf("response object is required\n%w", err) } var allArgs = []string{} diff --git a/lib/jwtutil/jwtutil.go b/lib/jwtutil/jwtutil.go index e5f0dbd8e..43ae3f4bb 100644 --- a/lib/jwtutil/jwtutil.go +++ b/lib/jwtutil/jwtutil.go @@ -104,7 +104,7 @@ func bodyToString(responseBody io.Reader) (bodyString string, err error) { return "", err } bodyString = string(bodyBytes) - fs.Debugf(nil, "jwtutil: Response Body: "+bodyString) + fs.Debugf(nil, "jwtutil: Response Body: %q", bodyString) return bodyString, nil } diff --git a/lib/terminal/terminal_normal.go b/lib/terminal/terminal_normal.go index 8b10212f6..a1b399a47 100644 --- a/lib/terminal/terminal_normal.go +++ b/lib/terminal/terminal_normal.go @@ -33,5 +33,5 @@ func ReadPassword(fd int) ([]byte, error) { // WriteTerminalTitle writes a string to the terminal title func WriteTerminalTitle(title string) { - fmt.Printf(ChangeTitle + title + BEL) + fmt.Print(ChangeTitle + title + BEL) }