mirror of
https://github.com/gohugoio/hugo.git
synced 2025-08-09 19:47:02 +02:00
common/hexec: Remove github.com/cli/safeexec
We began using the safeexec package in v0.79.1 to address https://github.com/gohugoio/hugo/security/advisories/GHSA-8j34-9876-pvfq. The vulnerability was addressed by the Go team in 1.19, so the safeexec package is no longer needed. Closes #13516
This commit is contained in:
committed by
Bjørn Erik Pedersen
parent
f34cdc382a
commit
a6bd67793b
@@ -4,12 +4,11 @@ import (
|
||||
"fmt"
|
||||
"log"
|
||||
"os"
|
||||
"os/exec"
|
||||
"path/filepath"
|
||||
"regexp"
|
||||
"strings"
|
||||
|
||||
"github.com/gohugoio/hugo/common/hexec"
|
||||
|
||||
"github.com/gohugoio/hugo/common/hugio"
|
||||
|
||||
"github.com/spf13/afero"
|
||||
@@ -208,7 +207,7 @@ func removeAll(expression, content string) string {
|
||||
}
|
||||
|
||||
func rewrite(filename, rule string) {
|
||||
cmf, _ := hexec.SafeCommand("gofmt", "-w", "-r", rule, filename)
|
||||
cmf := exec.Command("gofmt", "-w", "-r", rule, filename)
|
||||
out, err := cmf.CombinedOutput()
|
||||
if err != nil {
|
||||
log.Fatal("gofmt failed:", string(out))
|
||||
@@ -217,7 +216,7 @@ func rewrite(filename, rule string) {
|
||||
|
||||
func goimports(dir string) {
|
||||
// Needs go install golang.org/x/tools/cmd/goimports@latest
|
||||
cmf, _ := hexec.SafeCommand("goimports", "-w", dir)
|
||||
cmf := exec.Command("goimports", "-w", dir)
|
||||
out, err := cmf.CombinedOutput()
|
||||
if err != nil {
|
||||
log.Fatal("goimports failed:", string(out))
|
||||
@@ -225,7 +224,7 @@ func goimports(dir string) {
|
||||
}
|
||||
|
||||
func gofmt(dir string) {
|
||||
cmf, _ := hexec.SafeCommand("gofmt", "-w", dir)
|
||||
cmf := exec.Command("gofmt", "-w", dir)
|
||||
out, err := cmf.CombinedOutput()
|
||||
if err != nil {
|
||||
log.Fatal("gofmt failed:", string(out))
|
||||
|
Reference in New Issue
Block a user