be sure to always remove newlines from msg

release/release-0.3.0
parent 78f5ecc262
commit b0e6153ce2
No known key found for this signature in database
GPG Key ID: 0B266738824CE0F0
  1. 10
      main.go

@ -9,6 +9,7 @@ import (
"github.com/spf13/viper"
"log"
"os"
"regexp"
)
type CheckCommand struct {
@ -78,9 +79,16 @@ func main() {
Unknown("no subcommands specificed.")
}
func removeNewline(s string) string {
re := regexp.MustCompile(` +\r?\n +`)
r := re.ReplaceAllString(s, " ")
re = regexp.MustCompile(`\s+`)
return re.ReplaceAllString(r, " ")
}
func PrintMsg(msg string) {
if msg != "" {
fmt.Println(" - " + msg)
fmt.Println(" - " + removeNewline(msg))
}
}

Loading…
Cancel
Save