From f300408fc09e9f25fddfe554905311df5cb9d652 Mon Sep 17 00:00:00 2001 From: Kevin Wan Date: Fri, 21 May 2021 10:38:38 +0800 Subject: [PATCH] fix golint issues, and optimize code (#705) --- tools/goctl/model/sql/util/newline.go | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/tools/goctl/model/sql/util/newline.go b/tools/goctl/model/sql/util/newline.go index b373b99160c6..86f9d6f5dd08 100644 --- a/tools/goctl/model/sql/util/newline.go +++ b/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) }