optimize(infra): remove tautological condition (#856)
This commit is contained in:
parent
59c1d9aa03
commit
f09c624988
|
|
@ -138,21 +138,17 @@ func (t *s3Client) CheckAndCreateBucket(ctx context.Context) error {
|
||||||
return nil // already exist
|
return nil // already exist
|
||||||
}
|
}
|
||||||
|
|
||||||
if err != nil {
|
awsErr, ok := err.(interface{ ErrorCode() string })
|
||||||
// bucket not exist
|
if !ok || awsErr.ErrorCode() != "404" {
|
||||||
if awsErr, ok := err.(interface{ ErrorCode() string }); ok && awsErr.ErrorCode() == "404" {
|
|
||||||
input := &s3.CreateBucketInput{
|
|
||||||
Bucket: aws.String(bucket),
|
|
||||||
}
|
|
||||||
// create bucket
|
|
||||||
_, err := client.CreateBucket(ctx, input)
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
// other case
|
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
return nil
|
// bucket not exist
|
||||||
|
input := &s3.CreateBucketInput{
|
||||||
|
Bucket: aws.String(bucket),
|
||||||
|
}
|
||||||
|
_, err = client.CreateBucket(ctx, input)
|
||||||
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
func (t *s3Client) PutObject(ctx context.Context, objectKey string, content []byte, opts ...storage.PutOptFn) error {
|
func (t *s3Client) PutObject(ctx context.Context, objectKey string, content []byte, opts ...storage.PutOptFn) error {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue