fix golint issues, and optimize code (#705)

master
Kevin Wan 4 years ago committed by GitHub
parent aaa39e17a3
commit f300408fc0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -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", "") return strings.NewReplacer("\r", "", "\n", "").Replace(s)
s = strings.ReplaceAll(s, "\n", "")
return s
} }

Loading…
Cancel
Save