diff options
author | Bjørn Erik Pedersen <[email protected]> | 2020-12-18 18:20:12 +0100 |
---|---|---|
committer | Bjørn Erik Pedersen <[email protected]> | 2020-12-19 17:03:07 +0100 |
commit | 10ae7c3210cd1add14d3750aa9512a87df0e1146 (patch) | |
tree | 6fa7eb1e9bfe093f3b611bbb286aefe591e1dc7a /scripts | |
parent | ae2d1bd52df0099190ef9195666d0788708b0385 (diff) | |
download | hugo-10ae7c3210cd1add14d3750aa9512a87df0e1146.tar.gz hugo-10ae7c3210cd1add14d3750aa9512a87df0e1146.zip |
Improve LookPath
Diffstat (limited to 'scripts')
-rw-r--r-- | scripts/fork_go_templates/main.go | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/scripts/fork_go_templates/main.go b/scripts/fork_go_templates/main.go index c295ab734..b66c8a111 100644 --- a/scripts/fork_go_templates/main.go +++ b/scripts/fork_go_templates/main.go @@ -5,11 +5,12 @@ import ( "io/ioutil" "log" "os" - "os/exec" "path/filepath" "regexp" "strings" + "github.com/gohugoio/hugo/common/hexec" + "github.com/gohugoio/hugo/common/hugio" "github.com/spf13/afero" @@ -203,7 +204,7 @@ func removeAll(expression, content string) string { } func rewrite(filename, rule string) { - cmf := exec.Command("gofmt", "-w", "-r", rule, filename) + cmf, _ := hexec.SafeCommand("gofmt", "-w", "-r", rule, filename) out, err := cmf.CombinedOutput() if err != nil { log.Fatal("gofmt failed:", string(out)) @@ -211,7 +212,7 @@ func rewrite(filename, rule string) { } func goimports(dir string) { - cmf := exec.Command("goimports", "-w", dir) + cmf, _ := hexec.SafeCommand("goimports", "-w", dir) out, err := cmf.CombinedOutput() if err != nil { log.Fatal("goimports failed:", string(out)) @@ -219,7 +220,7 @@ func goimports(dir string) { } func gofmt(dir string) { - cmf := exec.Command("gofmt", "-w", dir) + cmf, _ := hexec.SafeCommand("gofmt", "-w", dir) out, err := cmf.CombinedOutput() if err != nil { log.Fatal("gofmt failed:", string(out)) |