diff --git a/backend/azureblob/azureblob.go b/backend/azureblob/azureblob.go index 8e8d9bbdf..2a823b4b3 100644 --- a/backend/azureblob/azureblob.go +++ b/backend/azureblob/azureblob.go @@ -392,7 +392,6 @@ func NewFs(name, root string, m configmap.Mapper) (fs.Fs, error) { return nil, errors.New("Container name in SAS URL and container provided in command do not match") } - container = parts.ContainerName containerURL = azblob.NewContainerURL(*u, pipeline) } else { serviceURL = azblob.NewServiceURL(*u, pipeline) diff --git a/backend/cache/cache_internal_test.go b/backend/cache/cache_internal_test.go index 266d89df1..3cd720606 100644 --- a/backend/cache/cache_internal_test.go +++ b/backend/cache/cache_internal_test.go @@ -726,6 +726,7 @@ func TestInternalChangeSeenAfterRc(t *testing.T) { // Call the rc function m, err := cacheExpire.Fn(rc.Params{"remote": "data.bin"}) + require.NoError(t, err) require.Contains(t, m, "status") require.Contains(t, m, "message") require.Equal(t, "ok", m["status"]) @@ -735,18 +736,21 @@ func TestInternalChangeSeenAfterRc(t *testing.T) { co, err = rootFs.NewObject("data.bin") require.NoError(t, err) require.Equal(t, wrappedTime.Unix(), co.ModTime().Unix()) - li1, err := runInstance.list(t, rootFs, "") + _, err = runInstance.list(t, rootFs, "") + require.NoError(t, err) // create some rand test data testData2 := randStringBytes(int(chunkSize)) runInstance.writeObjectBytes(t, cfs.UnWrap(), runInstance.encryptRemoteIfNeeded(t, "test2"), testData2) // list should have 1 item only - li1, err = runInstance.list(t, rootFs, "") + li1, err := runInstance.list(t, rootFs, "") + require.NoError(t, err) require.Len(t, li1, 1) // Call the rc function m, err = cacheExpire.Fn(rc.Params{"remote": "/"}) + require.NoError(t, err) require.Contains(t, m, "status") require.Contains(t, m, "message") require.Equal(t, "ok", m["status"]) @@ -754,6 +758,7 @@ func TestInternalChangeSeenAfterRc(t *testing.T) { // list should have 2 items now li2, err := runInstance.list(t, rootFs, "") + require.NoError(t, err) require.Len(t, li2, 2) } @@ -1490,7 +1495,8 @@ func (r *run) updateData(t *testing.T, rootFs fs.Fs, src, data, append string) e var err error if r.useMount { - f, err := os.OpenFile(path.Join(runInstance.mntDir, src), os.O_TRUNC|os.O_CREATE|os.O_WRONLY, 0644) + var f *os.File + f, err = os.OpenFile(path.Join(runInstance.mntDir, src), os.O_TRUNC|os.O_CREATE|os.O_WRONLY, 0644) if err != nil { return err } @@ -1500,7 +1506,8 @@ func (r *run) updateData(t *testing.T, rootFs fs.Fs, src, data, append string) e }() _, err = f.WriteString(data + append) } else { - obj1, err := rootFs.NewObject(src) + var obj1 fs.Object + obj1, err = rootFs.NewObject(src) if err != nil { return err } diff --git a/backend/drive/drive.go b/backend/drive/drive.go index be7279194..c3c1a35d7 100644 --- a/backend/drive/drive.go +++ b/backend/drive/drive.go @@ -2586,6 +2586,9 @@ func (o *Object) Update(in io.Reader, src fs.ObjectInfo, options ...fs.OpenOptio return err } newO, err := o.fs.newObjectWithInfo(src.Remote(), info) + if err != nil { + return err + } switch newO := newO.(type) { case *Object: *o = *newO @@ -2624,6 +2627,9 @@ func (o *documentObject) Update(in io.Reader, src fs.ObjectInfo, options ...fs.O remote = remote[:len(remote)-o.extLen] newO, err := o.fs.newObjectWithInfo(remote, info) + if err != nil { + return err + } switch newO := newO.(type) { case *documentObject: *o = *newO diff --git a/fs/rc/cache_test.go b/fs/rc/cache_test.go index 6b9bab6be..6d53d6e2f 100644 --- a/fs/rc/cache_test.go +++ b/fs/rc/cache_test.go @@ -114,11 +114,11 @@ func TestGetFsAndRemoteNamed(t *testing.T) { assert.NotNil(t, f) assert.Equal(t, "hello", remote) - f, remote, err = GetFsAndRemoteNamed(in, "fsX", "remote") + f, _, err = GetFsAndRemoteNamed(in, "fsX", "remote") require.Error(t, err) assert.Nil(t, f) - f, remote, err = GetFsAndRemoteNamed(in, "fs", "remoteX") + f, _, err = GetFsAndRemoteNamed(in, "fs", "remoteX") require.Error(t, err) assert.Nil(t, f) diff --git a/fs/rc/config_test.go b/fs/rc/config_test.go index ed954a203..071dc0185 100644 --- a/fs/rc/config_test.go +++ b/fs/rc/config_test.go @@ -74,7 +74,7 @@ func TestOptionsSet(t *testing.T) { "Int": 50, }, } - out, err = call.Fn(in) + _, err = call.Fn(in) require.Error(t, err) assert.Contains(t, err.Error(), "unknown option block") @@ -82,7 +82,7 @@ func TestOptionsSet(t *testing.T) { in = Params{ "potato": []string{"a", "b"}, } - out, err = call.Fn(in) + _, err = call.Fn(in) require.Error(t, err) assert.Contains(t, err.Error(), "failed to write options") }