瀏覽代碼

fix golint issues, and optimize code (#705)

Kevin Wan 4 年之前
父節點
當前提交
f300408fc0
共有 1 個文件被更改,包括 2 次插入3 次删除
  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"
 
+// TrimNewLine trims \r and \n chars.
 func TrimNewLine(s string) string {
-	s = strings.ReplaceAll(s, "\r", "")
-	s = strings.ReplaceAll(s, "\n", "")
-	return s
+	return strings.NewReplacer("\r", "", "\n", "").Replace(s)
 }