From 52033b32f702d1b0c0157b9dd9ecb77e8ddf82b0 Mon Sep 17 00:00:00 2001 From: Tommy Nguyen Date: Thu, 16 Aug 2018 17:04:39 -0400 Subject: [PATCH] Use strings.Replace instead of regexp --- pkg/commands/os.go | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/pkg/commands/os.go b/pkg/commands/os.go index c23b48c82..08db71fbb 100644 --- a/pkg/commands/os.go +++ b/pkg/commands/os.go @@ -5,7 +5,7 @@ import ( "os" "os/exec" "runtime" - "regexp" + "strings" "github.com/davecgh/go-spew/spew" @@ -171,7 +171,6 @@ func (c *OSCommand) PrepareSubProcess(cmdName string, commandArgs ...string) (*e // Quote wraps a message in platform-specific quotation marks func (c *OSCommand) Quote(message string) string { - r := regexp.MustCompile("`") - message = r.ReplaceAllString(message, "\\`") + message = strings.Replace(message, "`", "\\`", -1) return c.Platform.escapedQuote + message + c.Platform.escapedQuote }