Skip to content

Commit

Permalink
Merge pull request #17 from carlossless/escape-qoutation-marks
Browse files Browse the repository at this point in the history
Wrap targets in single quotes / escape quotation marks
  • Loading branch information
orangekame3 authored Oct 14, 2023
2 parents 580ccaa + 3defaf4 commit 94cdf37
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
6 changes: 3 additions & 3 deletions cmd/util.go
Original file line number Diff line number Diff line change
Expand Up @@ -90,14 +90,14 @@ func slice2String(slice []string) string {
buffer.WriteString(slice[0])
return buffer.String()
}
buffer.WriteString(`{`)
buffer.WriteString(`{'`)
for i, item := range slice {
buffer.WriteString(item)
if i < len(slice)-1 {
buffer.WriteString(",")
buffer.WriteString("','")
}
}
buffer.WriteString(`}`)
buffer.WriteString(`'}`)
return buffer.String()
}

Expand Down
4 changes: 2 additions & 2 deletions cmd/util_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -164,8 +164,8 @@ func Test_slice2String(t *testing.T) {
}{
{
name: "スライスをストリングに変換",
input: []string{"aws_iam_role_policy_attachment.local_poilcy_attachment", "aws_lambda_function.local_lambda", "aws_iam_policy.local_policy", "aws_lambda_event_source_mapping.local_mapping"},
want: "{aws_iam_role_policy_attachment.local_poilcy_attachment,aws_lambda_function.local_lambda,aws_iam_policy.local_policy,aws_lambda_event_source_mapping.local_mapping}",
input: []string{"aws_iam_role_policy_attachment.local_poilcy_attachment", "aws_lambda_function.local_lambda", "aws_iam_policy.local_policy", "aws_lambda_event_source_mapping.local_mapping", "aws_lambda_function.lambda_set[\"test\"]"},
want: "{'aws_iam_role_policy_attachment.local_poilcy_attachment','aws_lambda_function.local_lambda','aws_iam_policy.local_policy','aws_lambda_event_source_mapping.local_mapping','aws_lambda_function.lambda_set[\"test\"]'}",
},
}
for _, tt := range tests {
Expand Down

0 comments on commit 94cdf37

Please sign in to comment.