Skip to content

Commit e841159

Browse files
committed
Refactor to use strings.ReplaceAll (oapi-codegen#1079)
1 parent 7e23b37 commit e841159

2 files changed

Lines changed: 3 additions & 3 deletions

File tree

pkg/codegen/codegen.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -820,7 +820,7 @@ func GenerateUnionAndAdditionalProopertiesBoilerplate(t *template.Template, type
820820
func SanitizeCode(goCode string) string {
821821
// remove any byte-order-marks which break Go-Code
822822
// See: https://groups.google.com/forum/#!topic/golang-nuts/OToNIPdfkks
823-
return strings.Replace(goCode, "\uFEFF", "", -1)
823+
return strings.ReplaceAll(goCode, "\uFEFF", "")
824824
}
825825

826826
// GetUserTemplateText attempts to retrieve the template text from a passed in URL or file

pkg/codegen/utils.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -728,8 +728,8 @@ func stringToGoCommentWithPrefix(in, prefix string) string {
728728
}
729729

730730
// Normalize newlines from Windows/Mac to Linux
731-
in = strings.Replace(in, "\r\n", "\n", -1)
732-
in = strings.Replace(in, "\r", "\n", -1)
731+
in = strings.ReplaceAll(in, "\r\n", "\n")
732+
in = strings.ReplaceAll(in, "\r", "\n")
733733

734734
// Add comment to each line
735735
var lines []string

0 commit comments

Comments
 (0)