summaryrefslogtreecommitdiffstats
path: root/tpl/internal/go_templates/testenv/testenv.go
diff options
context:
space:
mode:
authorBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>2023-12-04 12:07:54 +0100
committerGitHub <noreply@github.com>2023-12-04 12:07:54 +0100
commit9f978d387f8b7cb6bc03fe6b4dd52bb16862a784 (patch)
treedc53e021fbf8a89e7ff0d3e86bbe9416ce5d7ecb /tpl/internal/go_templates/testenv/testenv.go
parent14d85ec136413dcfc96ad8e4d31633f8f9cbf410 (diff)
Pull in the latest code from Go's template packages (#11771)
Fixes #10707 Fixes #11507
Diffstat (limited to 'tpl/internal/go_templates/testenv/testenv.go')
-rw-r--r--tpl/internal/go_templates/testenv/testenv.go18
1 files changed, 8 insertions, 10 deletions
diff --git a/tpl/internal/go_templates/testenv/testenv.go b/tpl/internal/go_templates/testenv/testenv.go
index 2430ae6cf..97d897a1f 100644
--- a/tpl/internal/go_templates/testenv/testenv.go
+++ b/tpl/internal/go_templates/testenv/testenv.go
@@ -15,10 +15,6 @@ import (
"errors"
"flag"
"fmt"
-
- "github.com/gohugoio/hugo/tpl/internal/go_templates/cfg"
-
- //"internal/platform"
"os"
"os/exec"
"path/filepath"
@@ -27,6 +23,8 @@ import (
"strings"
"sync"
"testing"
+
+ "github.com/gohugoio/hugo/tpl/internal/go_templates/cfg"
)
// Save the original environment during init for use in checks. A test
@@ -45,8 +43,8 @@ func Builder() string {
// HasGoBuild reports whether the current system can build programs with “go build”
// and then run them with os.StartProcess or exec.Command.
+// Modified by Hugo (not needed)
func HasGoBuild() bool {
- // Modified by Hugo (not needed)
return false
}
@@ -69,13 +67,13 @@ func MustHaveGoBuild(t testing.TB) {
}
}
-// HasGoRun reports whether the current system can run programs with “go run.”
+// HasGoRun reports whether the current system can run programs with “go run”.
func HasGoRun() bool {
// For now, having go run and having go build are the same.
return HasGoBuild()
}
-// MustHaveGoRun checks that the current system can run programs with “go run.”
+// MustHaveGoRun checks that the current system can run programs with “go run”.
// If not, MustHaveGoRun calls t.Skip with an explanation.
func MustHaveGoRun(t testing.TB) {
if !HasGoRun() {
@@ -300,8 +298,8 @@ func MustHaveCGO(t testing.TB) {
// CanInternalLink reports whether the current system can link programs with
// internal linking.
+// Modified by Hugo (not needed)
func CanInternalLink(withCgo bool) bool {
- // Modified by Hugo (not needed)
return false
}
@@ -320,8 +318,8 @@ func MustInternalLink(t testing.TB, withCgo bool) {
// MustHaveBuildMode reports whether the current system can build programs in
// the given build mode.
// If not, MustHaveBuildMode calls t.Skip with an explanation.
+// Modified by Hugo (not needed)
func MustHaveBuildMode(t testing.TB, buildmode string) {
- // Modified by Hugo (not needed)
}
// HasSymlink reports whether the current system can use os.Symlink.
@@ -438,7 +436,7 @@ func WriteImportcfg(t testing.TB, dstPath string, packageFiles map[string]string
}
}
- if err := os.WriteFile(dstPath, icfg.Bytes(), 0666); err != nil {
+ if err := os.WriteFile(dstPath, icfg.Bytes(), 0o666); err != nil {
t.Fatal(err)
}
}