"rsync for cloud storage" - Google Drive, S3, Dropbox, Backblaze B2, One Drive, Swift, Hubic, Wasabi, Google Cloud Storage, Azure Blob, Azure Files, Yandex Files
Go azure-blobazure-blob-storageazure-filesbackblaze-b2cloud-storagedropboxencryptionftpfuse-filesystemgogolanggoogle-cloud-storagegoogle-driveonedriveopenstack-swiftrclones3sftpsyncwebdav
Fixes from go vet and errcheck
Nick Craig-Wood2ed158aba39a
diff --git a/dropbox/dropbox.go b/dropbox/dropbox.goindex 7a94b2b4f..57ec49aa5 100644--- a/dropbox/dropbox.go+++ b/dropbox/dropbox.go@@ -71,7 +71,10 @@ func configHelper(name string) {}// Get a dropbox- db := newDropbox(name)+ db, err := newDropbox(name)+ if err != nil {+ log.Fatalf("Failed to create dropbox client: %v", err)+ }// This method will ask the user to visit an URL and paste the generated code.if err := db.Auth(); err != nil {@@ -125,7 +128,7 @@ func (f *FsDropbox) String() string {}// Makes a new dropbox from the config-func newDropbox(name string) *dropbox.Dropbox {+func newDropbox(name string) (*dropbox.Dropbox, error) {db := dropbox.NewDropbox()appKey := fs.ConfigFile.MustValue(name, "app_key")@@ -137,9 +140,8 @@ func newDropbox(name string) *dropbox.Dropbox {appSecret = fs.Reveal(rcloneAppSecret)}- db.SetAppInfo(appKey, appSecret)-- return db+ err := db.SetAppInfo(appKey, appSecret)+ return db, err}// NewFs contstructs an FsDropbox from the path, container:path@@ -147,7 +149,10 @@ func NewFs(name, root string) (fs.Fs, error) {if uploadChunkSize > maxUploadChunkSize {return nil, fmt.Errorf("Chunk size too big, must be < %v", maxUploadChunkSize)}- db := newDropbox(name)+ db, err := newDropbox(name)+ if err != nil {+ return nil, err+ }f := &FsDropbox{name: name,db: db,diff --git a/dropbox/nametree.go b/dropbox/nametree.goindex da68ca691..5630cf388 100644--- a/dropbox/nametree.go+++ b/dropbox/nametree.go@@ -3,9 +3,10 @@ package dropboximport ("bytes""fmt"+ "strings"+"github.com/ncw/rclone/fs""github.com/stacktic/dropbox"- "strings")type NameTreeNode struct {@@ -135,8 +136,8 @@ func (tree *NameTreeNode) GetPathWithCorrectCase(path string) *string {return nil}- result.WriteString("/")- result.WriteString(current.CaseCorrectName)+ _, _ = result.WriteString("/")+ _, _ = result.WriteString(current.CaseCorrectName)}resultString := result.String()diff --git a/fs/operations.go b/fs/operations.goindex d8b5d7945..20a93b2bc 100644--- a/fs/operations.go+++ b/fs/operations.go@@ -326,11 +326,16 @@ func PairMover(in ObjectPairChan, fdst Fs, wg *sync.WaitGroup) {err := dst.Remove()if err != nil {Stats.Error()- ErrorLog(dst, "Couldn't delete: %s", err)+ ErrorLog(dst, "Couldn't delete: %v", err)}}- fdstMover.Move(src, src.Remote())- Debug(src, "Moved")+ _, err := fdstMover.Move(src, src.Remote())+ if err != nil {+ Stats.Error()+ ErrorLog(dst, "Couldn't move: %v", err)+ } else {+ Debug(src, "Moved")+ }} else {Copy(fdst, pair.dst, src)}@@ -615,10 +620,12 @@ func ListFn(f Fs, fn func(Object)) error {var outMutex sync.Mutex// Synchronized fmt.Fprintf-func syncFprintf(w io.Writer, format string, a ...interface{}) (n int, err error) {+//+// Ignores errors from Fprintf+func syncFprintf(w io.Writer, format string, a ...interface{}) {outMutex.Lock()defer outMutex.Unlock()- return fmt.Fprintf(w, format, a...)+ _, _ = fmt.Fprintf(w, format, a...)}// List the Fs to the supplied writerdiff --git a/oauthutil/oauthutil.go b/oauthutil/oauthutil.goindex 21b23ff29..80c27ccab 100644--- a/oauthutil/oauthutil.go+++ b/oauthutil/oauthutil.go@@ -121,7 +121,10 @@ func (ts *tokenSource) Token() (*oauth2.Token, error) {return nil, err}if *token != ts.OldToken {- putToken(ts.Name, token)+ err = putToken(ts.Name, token)+ if err != nil {+ return nil, err+ }}return token, nil}@@ -303,8 +306,8 @@ func (s *authServer) Start() {if err != nil {log.Fatalf("Failed to start auth webserver: %v", err)}- server.Serve(s.listener)- fs.Debug(nil, "Closed auth server")+ err = server.Serve(s.listener)+ fs.Debug(nil, "Closed auth server with error: %v", err)}func (s *authServer) Stop() {diff --git a/pacer/pacer_test.go b/pacer/pacer_test.goindex e0c1c5728..bd399d954 100644--- a/pacer/pacer_test.go+++ b/pacer/pacer_test.go@@ -205,7 +205,7 @@ func TestAmazonCloudDrivePacer(t *testing.T) {got := sum / n//t.Logf("%+v: got = %v", test, got)if got < (test.want*9)/10 || got > (test.want*11)/10 {- t.Fatalf("%+v: bad sleep want %v+/-10% got %v", test, test.want, got)+ t.Fatalf("%+v: bad sleep want %v+/-10%% got %v", test, test.want, got)}}}diff --git a/rclone.go b/rclone.goindex 36a3f4118..adc6444d8 100644--- a/rclone.go+++ b/rclone.go@@ -356,7 +356,10 @@ func main() {if err != nil {log.Fatalf("Failed to open log file: %v", err)}- f.Seek(0, os.SEEK_END)+ _, err = f.Seek(0, os.SEEK_END)+ if err != nil {+ log.Printf("Failed to seek log file to end: %v", err)+ }log.SetOutput(f)redirectStderr(f)}diff --git a/s3/v2sign.go b/s3/v2sign.goindex 834e0ba5e..8398741e9 100644--- a/s3/v2sign.go+++ b/s3/v2sign.go@@ -106,7 +106,7 @@ func sign(AccessKey, SecretKey string, req *http.Request) {// Make signaturepayload := req.Method + "\n" + md5 + "\n" + contentType + "\n" + date + "\n" + joinedHeadersToSign + urihash := hmac.New(sha1.New, []byte(SecretKey))- hash.Write([]byte(payload))+ _, _ = hash.Write([]byte(payload))signature := make([]byte, base64.StdEncoding.EncodedLen(hash.Size()))base64.StdEncoding.Encode(signature, hash.Sum(nil))