Skip to content

Commit

Permalink
another wip commit
Browse files Browse the repository at this point in the history
Signed-off-by: rakeshgm <[email protected]>
  • Loading branch information
rakeshgm committed Nov 16, 2023
1 parent 5f2e149 commit 97e626a
Showing 1 changed file with 12 additions and 11 deletions.
23 changes: 12 additions & 11 deletions controllers/s3utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -224,8 +224,8 @@ func (s *s3ObjectStore) CreateBucket(bucket string) (err error) {

cbInput := &s3.CreateBucketInput{Bucket: &bucket}
if err = cbInput.Validate(); err != nil {
return fmt.Errorf("create bucket input validation failed for %s, err %w",
bucket, err)
errMsgPrefix := fmt.Errorf("create bucket input validation failed for %s", bucket)
return processAwsError(errMsgPrefix, err)

Check failure on line 228 in controllers/s3utils.go

View workflow job for this annotation

GitHub Actions / Golangci Lint

return with no blank line before (nlreturn)
}

_, err = s.client.CreateBucket(cbInput)
Expand All @@ -236,8 +236,8 @@ func (s *s3ObjectStore) CreateBucket(bucket string) (err error) {
case s3.ErrCodeBucketAlreadyExists:
case s3.ErrCodeBucketAlreadyOwnedByYou:
default:
return fmt.Errorf("failed to create bucket %s, %w",
bucket, err)
return fmt.Errorf("failed to create bucket %s, %s: %s",
bucket, aerr.Code(), aerr.Message())
}
}
}
Expand Down Expand Up @@ -265,14 +265,14 @@ func (s *s3ObjectStore) DeleteBucket(bucket string) (

dbInput := &s3.DeleteBucketInput{Bucket: &bucket}
if err = dbInput.Validate(); err != nil {
return fmt.Errorf("delete bucket input validation failed for %s, err %w",
bucket, err)
errMsgPrefix := fmt.Errorf("delete bucket input validation failed for %s", bucket)
return processAwsError(errMsgPrefix, err)

Check failure on line 269 in controllers/s3utils.go

View workflow job for this annotation

GitHub Actions / Golangci Lint

return with no blank line before (nlreturn)
}

_, err = s.client.DeleteBucket(dbInput)
if err != nil && !isAwsErrCodeNoSuchBucket(err) {
return fmt.Errorf("failed to delete bucket %s, %w",
bucket, err)
errMsgPrefix := fmt.Errorf("failed to delete bucket %s", bucket)
return processAwsError(errMsgPrefix, err)

Check failure on line 275 in controllers/s3utils.go

View workflow job for this annotation

GitHub Actions / Golangci Lint

return with no blank line before (nlreturn)
}

return nil
Expand Down Expand Up @@ -301,9 +301,10 @@ func (s *s3ObjectStore) PurgeBucket(bucket string) (
return nil // Not an error
}

return fmt.Errorf("unable to ListKeys "+
"from endpoint %s bucket %s, %w",
s.s3Endpoint, bucket, err)
errMsgPrefix := fmt.Errorf("unable to ListKeys "+
"from endpoint %s bucket %s",
s.s3Endpoint, bucket)
return processAwsError(errMsgPrefix, err)

Check failure on line 307 in controllers/s3utils.go

View workflow job for this annotation

GitHub Actions / Golangci Lint

return statements should not be cuddled if block has more than two lines (wsl)
}

for _, key := range keys {
Expand Down

0 comments on commit 97e626a

Please sign in to comment.