feat(linter): enable errcheck linter in golangci-lint

Also, bump the linter version to the latest available version.

Signed-off-by: Milos Gajdos <milosthegajdos@gmail.com>
This commit is contained in:
Milos Gajdos
2023-11-18 06:50:40 +00:00
parent 9610a1e618
commit 7ce129d63b
36 changed files with 243 additions and 66 deletions

View File

@@ -186,6 +186,7 @@ func TestEmptyRootList(t *testing.T) {
if err != nil {
t.Fatalf("unexpected error creating content: %v", err)
}
// nolint:errcheck
defer rootedDriver.Delete(ctx, filename)
keys, _ := emptyRootDriver.List(ctx, "/")
@@ -230,6 +231,7 @@ func TestStorageClass(t *testing.T) {
if err != nil {
t.Fatalf("unexpected error creating content with storage class %v: %v", storageClass, err)
}
// nolint:errcheck
defer s3Driver.Delete(ctx, filename)
driverUnwrapped := s3Driver.Base.StorageDriver.(*driver)
@@ -751,17 +753,21 @@ func TestMoveWithMultipartCopy(t *testing.T) {
sourcePath := "/source"
destPath := "/dest"
// nolint:errcheck
defer d.Delete(ctx, sourcePath)
// nolint:errcheck
defer d.Delete(ctx, destPath)
// An object larger than d's MultipartCopyThresholdSize will cause d.Move() to perform a multipart copy.
multipartCopyThresholdSize := d.baseEmbed.Base.StorageDriver.(*driver).MultipartCopyThresholdSize
contents := make([]byte, 2*multipartCopyThresholdSize)
rand.Read(contents)
if _, err := rand.Read(contents); err != nil {
t.Fatalf("unexpected error creating content: %v", err)
}
err = d.PutContent(ctx, sourcePath, contents)
if err != nil {
t.Fatalf("unexpected error creating content: %v", err)
t.Fatalf("unexpected error writing content: %v", err)
}
err = d.Move(ctx, sourcePath, destPath)

View File

@@ -105,6 +105,9 @@ func Sign(req *request.Request) {
Time: req.Time,
Credentials: req.Config.Credentials,
}
// TODO(milosgajdos): figure this out; if Sign returns error which we should check,
// we should modify the codepath related to svc.Handlers.Sign.PushBack etc.
// nolint:errcheck
v2.Sign()
}