Skip to content

Commit

Permalink
error fix
Browse files Browse the repository at this point in the history
  • Loading branch information
shubhamvernekar committed Nov 15, 2023
1 parent 95fff87 commit 09b5f2d
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions store/aws/aws.go
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,19 @@ func (s StorageClient) ReadObject(ctx context.Context, bucketName, fileName stri
}

func (s StorageClient) ExistsObject(ctx context.Context, bucketName, fileName string) (bool, error) {
_, err := s.client.GetObject(ctx, &s3.GetObjectInput{
Bucket: aws.String(bucketName),
Key: aws.String(fileName),
})
if err != nil {
var notFoundType *types.NoSuchKey
if errors.As(err, &notFoundType) {
return false, nil
} else {

Check warning on line 138 in store/aws/aws.go

View workflow job for this annotation

GitHub Actions / golangci-lint

indent-error-flow: if block ends with a return statement, so drop this else and outdent its block (revive)

Check warning on line 138 in store/aws/aws.go

View workflow job for this annotation

GitHub Actions / golangci-lint

indent-error-flow: if block ends with a return statement, so drop this else and outdent its block (revive)
return false, err
}
}

return true, nil
}

Expand Down

0 comments on commit 09b5f2d

Please sign in to comment.