diff --git a/pkg/codegen/codegen.go b/pkg/codegen/codegen.go index 1cf431ed9c..d8ba40fca8 100644 --- a/pkg/codegen/codegen.go +++ b/pkg/codegen/codegen.go @@ -820,7 +820,7 @@ func GenerateUnionAndAdditionalProopertiesBoilerplate(t *template.Template, type func SanitizeCode(goCode string) string { // remove any byte-order-marks which break Go-Code // See: https://groups.google.com/forum/#!topic/golang-nuts/OToNIPdfkks - return strings.Replace(goCode, "\uFEFF", "", -1) + return strings.ReplaceAll(goCode, "\uFEFF", "") } // GetUserTemplateText attempts to retrieve the template text from a passed in URL or file diff --git a/pkg/codegen/utils.go b/pkg/codegen/utils.go index 6fb031e49c..cf8826e39f 100644 --- a/pkg/codegen/utils.go +++ b/pkg/codegen/utils.go @@ -728,8 +728,8 @@ func stringToGoCommentWithPrefix(in, prefix string) string { } // Normalize newlines from Windows/Mac to Linux - in = strings.Replace(in, "\r\n", "\n", -1) - in = strings.Replace(in, "\r", "\n", -1) + in = strings.ReplaceAll(in, "\r\n", "\n") + in = strings.ReplaceAll(in, "\r", "\n") // Add comment to each line var lines []string