Skip to content

Commit

Permalink
Use strings.ReplaceAll instead of strings.Replace -1 (#11)
Browse files Browse the repository at this point in the history
Co-authored-by: deepsource-autofix[bot] <62050782+deepsource-autofix[bot]@users.noreply.github.com>
  • Loading branch information
deepsource-autofix[bot] authored Oct 20, 2021
1 parent eab5a22 commit 7fa2319
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions builder/quote.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,14 +29,14 @@ type Quote struct {
}

func (q Quote) ID(name string) string {
return q.IDPrefix + strings.Replace(name, q.IDSuffix, q.IDSuffixEscapeChar+q.IDSuffix, -1) + q.IDSuffix
return q.IDPrefix + strings.ReplaceAll(name, q.IDSuffix, q.IDSuffixEscapeChar+q.IDSuffix) + q.IDSuffix
}

func (q Quote) Value(v interface{}) string {
switch v := v.(type) {
default:
panic("unsupported value")
case string:
return q.ValueQuote + strings.Replace(v, q.ValueQuote, q.ValueQuoteEscapeChar+q.ValueQuote, -1) + q.ValueQuote
return q.ValueQuote + strings.ReplaceAll(v, q.ValueQuote, q.ValueQuoteEscapeChar+q.ValueQuote) + q.ValueQuote
}
}

0 comments on commit 7fa2319

Please sign in to comment.