Skip to content

Commit 2e2172d

Browse files
willie-yaocpuguy83
authored andcommitted
Change go versions to bool
Signed-off-by: William Yao <[email protected]>
1 parent fd7520d commit 2e2172d

File tree

6 files changed

+17
-22
lines changed

6 files changed

+17
-22
lines changed

test/linux_target_test.go

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ import (
88
"encoding/json"
99
"errors"
1010
"fmt"
11-
"go/version"
1211
"io"
1312
"io/fs"
1413
"os"
@@ -97,10 +96,11 @@ type testLinuxConfig struct {
9796
Units string
9897
Targets string
9998
}
100-
Libdir string
101-
Worker workerConfig
102-
Release OSRelease
103-
GoVersion string
99+
Libdir string
100+
Worker workerConfig
101+
Release OSRelease
102+
103+
SupportsGomodVersionUpdate bool
104104

105105
Platforms []ocispecs.Platform
106106
PackageOutputPath func(spec *dalec.Spec, platform ocispecs.Platform) string
@@ -2274,8 +2274,7 @@ func True(t interface{}, value bool, msgAndArgs ...interface{}) bool {
22742274
t.Parallel()
22752275
ctx := startTestSpan(baseCtx, t)
22762276

2277-
// Skip on distros with Go versions below 1.21 that can't handle automatic toolchain management
2278-
skip.If(t, testConfig.GoVersion == "" || version.Compare("go"+testConfig.GoVersion, "go1.21") < 0,
2277+
skip.If(t, !testConfig.SupportsGomodVersionUpdate,
22792278
"Test requires Go 1.21+ for automatic toolchain management")
22802279

22812280
// Start with go.mod and go.work both at go 1.18

test/target_almalinux_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ func TestAlmalinux9(t *testing.T) {
4545
ID: "almalinux",
4646
VersionID: "9",
4747
},
48-
GoVersion: "1.25",
48+
SupportsGomodVersionUpdate: true,
4949
Platforms: []ocispecs.Platform{
5050
{OS: "linux", Architecture: "amd64"},
5151
{OS: "linux", Architecture: "arm64"},
@@ -91,7 +91,7 @@ func TestAlmalinux8(t *testing.T) {
9191
ID: "almalinux",
9292
VersionID: "8",
9393
},
94-
GoVersion: "1.25",
94+
SupportsGomodVersionUpdate: true,
9595
Platforms: []ocispecs.Platform{
9696
{OS: "linux", Architecture: "amd64"},
9797
{OS: "linux", Architecture: "arm64"},

test/target_azlinux_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ func TestMariner2(t *testing.T) {
7070
ID: "mariner",
7171
VersionID: "2.0",
7272
},
73-
GoVersion: "1.22",
73+
SupportsGomodVersionUpdate: true,
7474
Platforms: []ocispecs.Platform{
7575
{OS: "linux", Architecture: "amd64"},
7676
{OS: "linux", Architecture: "arm64"},
@@ -114,7 +114,7 @@ func TestAzlinux3(t *testing.T) {
114114
ID: "azurelinux",
115115
VersionID: "3.0",
116116
},
117-
GoVersion: "1.25",
117+
SupportsGomodVersionUpdate: true,
118118
Platforms: []ocispecs.Platform{
119119
{OS: "linux", Architecture: "amd64"},
120120
{OS: "linux", Architecture: "arm64"},

test/target_debian_test.go

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ func TestTrixie(t *testing.T) {
1616
testConf := debLinuxTestConfigFor(
1717
debian.TrixieDefaultTargetKey,
1818
debian.TrixieConfig,
19-
withGoVersion("1.24"),
19+
withSupportGomodVersionUpdate(),
2020
withPackageOverride("rust", "rust-all"),
2121
withPackageOverride("bazel", "bazel-bootstrap"),
2222
)
@@ -32,7 +32,6 @@ func TestBookworm(t *testing.T) {
3232
testConf := debLinuxTestConfigFor(
3333
debian.BookwormDefaultTargetKey,
3434
debian.BookwormConfig,
35-
withGoVersion("1.19"),
3635
withPackageOverride("rust", "rust-all"),
3736
withPackageOverride("bazel", "bazel-bootstrap"),
3837
)
@@ -48,7 +47,6 @@ func TestBullseye(t *testing.T) {
4847
testConf := debLinuxTestConfigFor(
4948
debian.BullseyeDefaultTargetKey,
5049
debian.BullseyeConfig,
51-
withGoVersion("1.19"),
5250
withPackageOverride("golang", "golang-1.19"),
5351
withPackageOverride("rust", "cargo-web"),
5452
withPackageOverride("bazel", noPackageAvailable),

test/target_rockylinux_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ func TestRockylinux9(t *testing.T) {
4545
ID: "rocky",
4646
VersionID: "9",
4747
},
48-
GoVersion: "1.25",
48+
SupportsGomodVersionUpdate: true,
4949
Platforms: []ocispecs.Platform{
5050
{OS: "linux", Architecture: "amd64"},
5151
{OS: "linux", Architecture: "arm64"},
@@ -91,7 +91,7 @@ func TestRockylinux8(t *testing.T) {
9191
ID: "rocky",
9292
VersionID: "8",
9393
},
94-
GoVersion: "1.25",
94+
SupportsGomodVersionUpdate: true,
9595
Platforms: []ocispecs.Platform{
9696
{OS: "linux", Architecture: "amd64"},
9797
{OS: "linux", Architecture: "arm64"},

test/target_ubuntu_test.go

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,9 @@ func withPackageOverride(oldPkg, newPkg string) func(cfg *testLinuxConfig) {
2323
}
2424
}
2525

26-
func withGoVersion(version string) func(cfg *testLinuxConfig) {
26+
func withSupportGomodVersionUpdate() func(cfg *testLinuxConfig) {
2727
return func(cfg *testLinuxConfig) {
28-
cfg.GoVersion = version
28+
cfg.SupportsGomodVersionUpdate = true
2929
}
3030
}
3131

@@ -160,7 +160,6 @@ func TestJammy(t *testing.T) {
160160

161161
ctx := startTestSpan(baseCtx, t)
162162
testConf := debLinuxTestConfigFor(ubuntu.JammyDefaultTargetKey, ubuntu.JammyConfig,
163-
withGoVersion("1.18"),
164163
withPackageOverride("rust", "rust-all"),
165164
withPackageOverride("bazel", noPackageAvailable),
166165
withPackageOverride("python", "python3 python3-pip"),
@@ -175,7 +174,7 @@ func TestNoble(t *testing.T) {
175174

176175
ctx := startTestSpan(baseCtx, t)
177176
testConf := debLinuxTestConfigFor(ubuntu.NobleDefaultTargetKey, ubuntu.NobleConfig,
178-
withGoVersion("1.22"),
177+
withSupportGomodVersionUpdate(),
179178
withPackageOverride("rust", "rust-all"),
180179
withPackageOverride("bazel", "bazel-bootstrap"),
181180
)
@@ -188,7 +187,7 @@ func TestFocal(t *testing.T) {
188187

189188
ctx := startTestSpan(baseCtx, t)
190189
testConf := debLinuxTestConfigFor(ubuntu.FocalDefaultTargetKey, ubuntu.FocalConfig,
191-
withGoVersion("1.22"),
190+
withSupportGomodVersionUpdate(),
192191
withPackageOverride("golang", "golang-1.22"),
193192
withPackageOverride("rust", "rust-all"),
194193
withPackageOverride("bazel", noPackageAvailable),
@@ -203,7 +202,6 @@ func TestBionic(t *testing.T) {
203202

204203
ctx := startTestSpan(baseCtx, t)
205204
testConf := debLinuxTestConfigFor(ubuntu.BionicDefaultTargetKey, ubuntu.BionicConfig,
206-
withGoVersion("1.18"),
207205
withPackageOverride("golang", "golang-1.18"),
208206
withPackageOverride("rust", "rust-all"),
209207
withPackageOverride("bazel", noPackageAvailable),

0 commit comments

Comments
 (0)