Go 1.21 Upgrade

Fixes #11351
This commit is contained in:
Bjørn Erik Pedersen
2023-08-23 18:23:52 +02:00
parent 111f02db2a
commit 24b1be45c1
26 changed files with 438 additions and 108 deletions

View File

@@ -5,16 +5,16 @@
package testenv_test
import (
"github.com/gohugoio/hugo/tpl/internal/go_templates/testenv"
//"internal/platform"
"os"
"path/filepath"
"runtime"
"strings"
"testing"
"github.com/gohugoio/hugo/tpl/internal/go_templates/testenv"
)
func TestGoToolLocation(t *testing.T) {
t.Skip("skipping test that requires go command")
testenv.MustHaveGoBuild(t)
var exeSuffix string
@@ -53,3 +53,33 @@ func TestGoToolLocation(t *testing.T) {
t.Fatalf("%q is not the same file as %q", absWant, goTool)
}
}
func TestHasGoBuild(t *testing.T) {
// Removed by Hugo.
}
func TestMustHaveExec(t *testing.T) {
hasExec := false
t.Run("MustHaveExec", func(t *testing.T) {
testenv.MustHaveExec(t)
t.Logf("MustHaveExec did not skip")
hasExec = true
})
switch runtime.GOOS {
case "js", "wasip1":
if hasExec {
// js and wasip1 lack an “exec” syscall.
t.Errorf("expected MustHaveExec to skip on %v", runtime.GOOS)
}
case "ios":
if b := testenv.Builder(); strings.HasSuffix(b, "-corellium") && !hasExec {
// Most ios environments can't exec, but the corellium builder can.
t.Errorf("expected MustHaveExec not to skip on %v", b)
}
default:
if b := testenv.Builder(); b != "" && !hasExec {
t.Errorf("expected MustHaveExec not to skip on %v", b)
}
}
}