Repository: go-to-k/delstack (go)
Issue: [Feature] display a bucket name in messages when delete objects API returns errors
Pull request description: feat: #111 display a bucket name when delete objects errors
Closes #111 

Patch:
diff --git a/go.mod b/go.mod
index 8f36120..6e124c1 100644
--- a/go.mod
+++ b/go.mod
@@ -15,7 +15,7 @@ require (
 	github.com/golang/mock v1.6.0
 	github.com/olekukonko/tablewriter v0.0.5
 	github.com/rs/zerolog v1.29.0
-	github.com/urfave/cli/v2 v2.23.0
+	github.com/urfave/cli/v2 v2.24.3
 	golang.org/x/sync v0.0.0-20220819030929-7fc1605a5dde
 )
 
diff --git a/go.sum b/go.sum
index 83c65c5..d0154df 100644
--- a/go.sum
+++ b/go.sum
@@ -95,8 +95,8 @@ github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQD
 github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
 github.com/stretchr/testify v1.6.1 h1:hDPOHmpOpP40lSULcqw7IrRb/u7w6RpDC9399XyoNd0=
 github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
-github.com/urfave/cli/v2 v2.23.0 h1:pkly7gKIeYv3olPAeNajNpLjeJrmTPYCoZWaV+2VfvE=
-github.com/urfave/cli/v2 v2.23.0/go.mod h1:1CNUng3PtjQMtRzJO4FMXBQvkGtuYRxxiR9xMa7jMwI=
+github.com/urfave/cli/v2 v2.24.3 h1:7Q1w8VN8yE0MJEHP06bv89PjYsN4IHWED2s1v/Zlfm0=
+github.com/urfave/cli/v2 v2.24.3/go.mod h1:GHupkWPMM0M/sj1a2b4wUrWBPzazNrIjouW6fmdJLxc=
 github.com/xrash/smetrics v0.0.0-20201216005158-039620a65673 h1:bAn7/zixMGCfxrRTfdpNzjtPYqr8smhKouy9mxVdGPU=
 github.com/xrash/smetrics v0.0.0-20201216005158-039620a65673/go.mod h1:N3UwUGtsrSj3ccvlPHLoLsHnpR27oXr4ZE984MbSER8=
 github.com/yuin/goldmark v1.3.5/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k=
diff --git a/internal/operation/s3_bucket.go b/internal/operation/s3_bucket.go
index 19f8910..49dec0a 100644
--- a/internal/operation/s3_bucket.go
+++ b/internal/operation/s3_bucket.go
@@ -74,12 +74,13 @@ func (o *S3BucketOperator) DeleteS3Bucket(ctx context.Context, bucketName *strin
 		if len(errors) > 0 {
 			errorStr := ""
 			for _, error := range errors {
-				errorStr += fmt.Sprintf("\nCode: %v\n", *error.Code)
+				errorStr += fmt.Sprintf("\nBucketName: %v\n", *bucketName)
+				errorStr += fmt.Sprintf("Code: %v\n", *error.Code)
 				errorStr += fmt.Sprintf("Key: %v\n", *error.Key)
 				errorStr += fmt.Sprintf("VersionId: %v\n", *error.VersionId)
 				errorStr += fmt.Sprintf("Message: %v\n", *error.Message)
 			}
-			return fmt.Errorf("DeleteObjectsError: followings %v", errorStr)
+			return fmt.Errorf("DeleteObjectsError: followings\n%v", errorStr)
 		}
 	}
 	if err := o.client.DeleteBucket(ctx, bucketName); err != nil {


Test patch:
diff --git a/internal/operation/s3_bucket_test.go b/internal/operation/s3_bucket_test.go
index 01b87ba..f2c2d58 100644
--- a/internal/operation/s3_bucket_test.go
+++ b/internal/operation/s3_bucket_test.go
@@ -160,7 +160,7 @@ func TestS3BucketOperator_DeleteS3Bucket(t *testing.T) {
 					},
 				}, nil)
 			},
-			want:    fmt.Errorf("DeleteObjectsError: followings \nCode: Code\nKey: Key\nVersionId: VersionId\nMessage: Message\n"),
+			want:    fmt.Errorf("DeleteObjectsError: followings\n\nBucketName: test\nCode: Code\nKey: Key\nVersionId: VersionId\nMessage: Message\n"),
 			wantErr: true,
 		},
 		{