Browse Source

fix golint issues, and optimize code (#705)

Kevin Wan 4 years ago
parent
commit
f300408fc0
1 changed files with 2 additions and 3 deletions
  1. 2 3
      tools/goctl/model/sql/util/newline.go

+ 2 - 3
tools/goctl/model/sql/util/newline.go

@@ -2,8 +2,7 @@ package util
 
 
 import "strings"
 import "strings"
 
 
+// TrimNewLine trims \r and \n chars.
 func TrimNewLine(s string) string {
 func TrimNewLine(s string) string {
-	s = strings.ReplaceAll(s, "\r", "")
-	s = strings.ReplaceAll(s, "\n", "")
-	return s
+	return strings.NewReplacer("\r", "", "\n", "").Replace(s)
 }
 }