mirror of
https://github.com/gohugoio/hugo.git
synced 2025-08-17 21:01:26 +02:00
Improve LookPath
This commit is contained in:
@@ -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))
|
||||
|
Reference in New Issue
Block a user