Skip to content

Commit b1bb5a0

Browse files
chore: bump go to 1.26.3 in gomod (#116)
* chore: bump go to 1.26.3 in gomod * chore: bump go version in CI and golangci-lint version * ci: bump go to 1.26.3 in the build/test pipeline * chore: fix linting issues due to golangci-lint upgrade
1 parent d9d0924 commit b1bb5a0

12 files changed

Lines changed: 119 additions & 91 deletions

File tree

.github/workflows/go.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ jobs:
1717
- uses: actions/checkout@v6
1818
- uses: actions/setup-go@v6
1919
with:
20-
go-version: '1.25.8'
20+
go-version: '1.26.3'
2121

2222
- name: Install dependencies
2323
run: |
@@ -27,7 +27,7 @@ jobs:
2727
- name: golangci-lint
2828
uses: golangci/golangci-lint-action@v9
2929
with:
30-
version: v2.11.3
30+
version: v2.12.2
3131
args: --build-tags containers_image_openpgp
3232

3333
- name: Check generated manpages are up to date
@@ -53,7 +53,7 @@ jobs:
5353
- name: Set up Go
5454
uses: actions/setup-go@v6
5555
with:
56-
go-version: '1.25.8'
56+
go-version: '1.26.3'
5757

5858
- name: Install dependencies
5959
run: |

cmd/schedctl/doctor.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,9 @@ func NewDoctorCmd() *cli.Command {
2020
" Exits non-zero when any blocking check fails.",
2121
Flags: []cli.Flag{
2222
&cli.StringFlag{
23-
Name: "output",
23+
Name: flagOutput,
2424
Aliases: []string{"o"},
25-
Usage: "output format: text, json",
25+
Usage: flagOutputUsage,
2626
Value: outputText,
2727
Local: true,
2828
Category: categoryDiagnostics,
@@ -35,7 +35,7 @@ func NewDoctorCmd() *cli.Command {
3535
func doctorAction(_ context.Context, cmd *cli.Command) error {
3636
report := doctor.Run(doctor.DefaultChecks())
3737

38-
switch cmd.String("output") {
38+
switch cmd.String(flagOutput) {
3939
case outputJSON:
4040
if err := doctor.WriteJSON(os.Stdout, report); err != nil {
4141
return err
@@ -46,7 +46,7 @@ func doctorAction(_ context.Context, cmd *cli.Command) error {
4646
}
4747
default:
4848
return fmt.Errorf("unsupported output format %q (expected %s or %s)",
49-
cmd.String("output"), outputText, outputJSON)
49+
cmd.String(flagOutput), outputText, outputJSON)
5050
}
5151

5252
if report.HasBlockingFailures() {

cmd/schedctl/info.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,9 @@ Examples:
3636
Category: categoryProcess,
3737
},
3838
&cli.StringFlag{
39-
Name: "output",
39+
Name: flagOutput,
4040
Aliases: []string{"o"},
41-
Usage: "output format: text, json",
41+
Usage: flagOutputUsage,
4242
Value: outputText,
4343
Local: true,
4444
Category: categoryDisplay,
@@ -56,7 +56,7 @@ func infoAction(_ context.Context, cmd *cli.Command) error {
5656

5757
schedulerID := args[0]
5858
version := cmd.String("version")
59-
format := cmd.String("output")
59+
format := cmd.String(flagOutput)
6060

6161
if format != outputText && format != outputJSON {
6262
return fmt.Errorf("unsupported --output value %q (expected: %s, %s)", format, outputText, outputJSON)

cmd/schedctl/list_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ func TestNewListCmd(t *testing.T) {
1616
listCmd := cmd.NewListCmd()
1717

1818
assert.NotNil(t, listCmd)
19-
assert.Equal(t, "list", listCmd.Name)
19+
assert.Equal(t, cmdList, listCmd.Name)
2020
assert.Equal(t, "list available schedulers", listCmd.Usage)
2121
}
2222

@@ -27,7 +27,7 @@ func TestListCmdExecute(t *testing.T) {
2727
r, w, _ := os.Pipe()
2828
os.Stdout = w
2929

30-
err := rootCmd.Run(context.Background(), []string{"schedctl", "list"})
30+
err := rootCmd.Run(context.Background(), []string{"schedctl", cmdList})
3131
w.Close()
3232
os.Stdout = oldStdout
3333

cmd/schedctl/root.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,11 @@ const (
1818
outputJSON = "json"
1919
)
2020

21+
const (
22+
flagOutput = "output"
23+
flagOutputUsage = "output format: text, json"
24+
)
25+
2126
func Execute() {
2227
rootCmd := NewRootCmd()
2328
if err := rootCmd.Run(context.Background(), os.Args); err != nil {

cmd/schedctl/root_test.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@ import (
1010
cmd "schedctl/cmd/schedctl"
1111
)
1212

13+
const cmdList = "list"
14+
1315
func lookupFlag(flags []cli.Flag, name string) cli.Flag {
1416
for _, f := range flags {
1517
for _, n := range f.Names() {
@@ -42,7 +44,7 @@ func TestNewRootCmd(t *testing.T) {
4244
func TestRootCmdHasSubcommands(t *testing.T) {
4345
rootCmd := cmd.NewRootCmd()
4446

45-
expected := []string{"run", "ps", "stop", "list", "doctor", "status", "versions", "info"}
47+
expected := []string{"run", "ps", "stop", cmdList, "doctor", "status", "versions", "info"}
4648
for _, name := range expected {
4749
assert.NotNil(t, findSubcommand(rootCmd, name), "Root command should have %s subcommand", name)
4850
}

cmd/schedctl/status.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,9 @@ Exit codes:
3434
See schedctl-status(1) for the full JSON schema.`,
3535
Flags: []cli.Flag{
3636
&cli.StringFlag{
37-
Name: "output",
37+
Name: flagOutput,
3838
Aliases: []string{"o"},
39-
Usage: "output format: text, json",
39+
Usage: flagOutputUsage,
4040
Value: outputText,
4141
Local: true,
4242
Category: categoryDisplay,
@@ -48,7 +48,7 @@ See schedctl-status(1) for the full JSON schema.`,
4848

4949
func statusAction(_ context.Context, cmd *cli.Command) error {
5050
driver := cmd.String("driver")
51-
format := cmd.String("output")
51+
format := cmd.String(flagOutput)
5252

5353
if format != outputText && format != outputJSON {
5454
return fmt.Errorf("unsupported --output value %q (expected: %s, %s)", format, outputText, outputJSON)

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
module schedctl
22

3-
go 1.25.8
3+
go 1.26.3
44

55
require (
66
github.com/anatol/vmtest v0.0.0-20230711210602-87511df0d4bc

internal/info/info_test.go

Lines changed: 56 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -13,61 +13,73 @@ import (
1313
"schedctl/internal/schedulers"
1414
)
1515

16+
const (
17+
rustyImage = "ghcr.io/schedkit/scx_rusty:latest"
18+
rustyDigest = "sha256:abc"
19+
rustyName = "scx_rusty"
20+
rustyDescription = "Rust user-space scheduler"
21+
rustyDocs = "https://example.com/docs"
22+
rustySource = "https://github.com/sched-ext/scx"
23+
rustyVersion = "1.0.0"
24+
rustyKernelMin = "6.12"
25+
sparseImage = "ghcr.io/example/sparse:latest"
26+
)
27+
1628
func TestBuildPopulatesAllCuratedFields(t *testing.T) {
1729
created := time.Date(2026, 4, 1, 12, 0, 0, 0, time.UTC)
1830
img := schedulers.SchedulerImage{
19-
ImageURI: "ghcr.io/schedkit/scx_rusty:latest",
31+
ImageURI: rustyImage,
2032
Source: schedulers.SourceManifest,
2133
}
2234
raw := schedulers.ImageInfo{
23-
ImageRef: "ghcr.io/schedkit/scx_rusty:latest",
24-
Digest: "sha256:abc",
35+
ImageRef: rustyImage,
36+
Digest: rustyDigest,
2537
Created: &created,
2638
Architecture: "amd64",
2739
OS: "linux",
2840
Labels: map[string]string{
29-
info.LabelTitle: "scx_rusty",
30-
info.LabelDescription: "Rust user-space scheduler",
31-
info.LabelDocumentation: "https://example.com/docs",
32-
info.LabelSource: "https://github.com/sched-ext/scx",
33-
info.LabelVersion: "1.0.0",
41+
info.LabelTitle: rustyName,
42+
info.LabelDescription: rustyDescription,
43+
info.LabelDocumentation: rustyDocs,
44+
info.LabelSource: rustySource,
45+
info.LabelVersion: rustyVersion,
3446
info.LabelRevision: "deadbee",
3547
info.LabelAuthors: "scx team",
3648
info.LabelLicenses: "GPL-2.0",
3749
info.LabelVendor: "schedkit",
38-
info.LabelKernelMin: "6.12",
50+
info.LabelKernelMin: rustyKernelMin,
3951
},
4052
}
4153

42-
r := info.Build("scx_rusty", img, raw)
54+
r := info.Build(rustyName, img, raw)
4355

4456
assert.Equal(t, info.SchemaVersion, r.SchemaVersion)
45-
assert.Equal(t, "scx_rusty", r.Scheduler)
57+
assert.Equal(t, rustyName, r.Scheduler)
4658
assert.Equal(t, "manifest", r.Source)
47-
assert.Equal(t, "ghcr.io/schedkit/scx_rusty:latest", r.ImageRef)
48-
assert.Equal(t, "sha256:abc", r.Digest)
59+
assert.Equal(t, rustyImage, r.ImageRef)
60+
assert.Equal(t, rustyDigest, r.Digest)
4961
assert.Equal(t, &created, r.Created)
5062
assert.Equal(t, "amd64", r.Architecture)
5163
assert.Equal(t, "linux", r.OS)
52-
assert.Equal(t, "scx_rusty", r.Title)
53-
assert.Equal(t, "Rust user-space scheduler", r.Description)
54-
assert.Equal(t, "https://example.com/docs", r.Documentation)
55-
assert.Equal(t, "https://github.com/sched-ext/scx", r.SourceURL)
56-
assert.Equal(t, "1.0.0", r.Version)
64+
assert.Equal(t, rustyName, r.Title)
65+
assert.Equal(t, rustyDescription, r.Description)
66+
assert.Equal(t, rustyDocs, r.Documentation)
67+
assert.Equal(t, rustySource, r.SourceURL)
68+
assert.Equal(t, rustyVersion, r.Version)
5769
assert.Equal(t, "deadbee", r.Revision)
5870
assert.Equal(t, "scx team", r.Authors)
5971
assert.Equal(t, "GPL-2.0", r.Licenses)
6072
assert.Equal(t, "schedkit", r.Vendor)
61-
assert.Equal(t, "6.12", r.KernelMin)
73+
assert.Equal(t, rustyKernelMin, r.KernelMin)
6274
}
6375

6476
func TestBuildOmitsMissingLabels(t *testing.T) {
6577
img := schedulers.SchedulerImage{
66-
ImageURI: "ghcr.io/example/sparse:latest",
78+
ImageURI: sparseImage,
6779
Source: schedulers.SourceDirect,
6880
}
6981
raw := schedulers.ImageInfo{
70-
ImageRef: "ghcr.io/example/sparse:latest",
82+
ImageRef: sparseImage,
7183
Labels: map[string]string{
7284
info.LabelTitle: "sparse",
7385
},
@@ -103,11 +115,11 @@ func TestBuildWithEmptyLabelMap(t *testing.T) {
103115
func TestWriteJSONOmitsEmptyFields(t *testing.T) {
104116
r := info.Report{
105117
SchemaVersion: info.SchemaVersion,
106-
Scheduler: "scx_rusty",
118+
Scheduler: rustyName,
107119
Source: "manifest",
108-
ImageRef: "ghcr.io/schedkit/scx_rusty:latest",
109-
Digest: "sha256:abc",
110-
Title: "scx_rusty",
120+
ImageRef: rustyImage,
121+
Digest: rustyDigest,
122+
Title: rustyName,
111123
}
112124
var buf bytes.Buffer
113125
err := info.WriteJSON(&buf, r)
@@ -116,8 +128,8 @@ func TestWriteJSONOmitsEmptyFields(t *testing.T) {
116128
var decoded map[string]any
117129
assert.NoError(t, json.Unmarshal(buf.Bytes(), &decoded))
118130
assert.Equal(t, "1", decoded["schema_version"])
119-
assert.Equal(t, "scx_rusty", decoded["scheduler"])
120-
assert.Equal(t, "sha256:abc", decoded["digest"])
131+
assert.Equal(t, rustyName, decoded["scheduler"])
132+
assert.Equal(t, rustyDigest, decoded["digest"])
121133
_, hasEmpty := decoded["description"]
122134
assert.False(t, hasEmpty, "empty fields should be omitted from JSON")
123135
_, hasKernel := decoded["kernel_min_version"]
@@ -126,29 +138,29 @@ func TestWriteJSONOmitsEmptyFields(t *testing.T) {
126138

127139
func TestWriteTextIncludesKeyFields(t *testing.T) {
128140
r := info.Report{
129-
Scheduler: "scx_rusty",
130-
Title: "scx_rusty",
131-
Description: "Rust user-space scheduler",
132-
ImageRef: "ghcr.io/schedkit/scx_rusty:latest",
133-
Digest: "sha256:abc",
134-
KernelMin: "6.12",
135-
Documentation: "https://example.com/docs",
136-
SourceURL: "https://github.com/sched-ext/scx",
137-
Version: "1.0.0",
141+
Scheduler: rustyName,
142+
Title: rustyName,
143+
Description: rustyDescription,
144+
ImageRef: rustyImage,
145+
Digest: rustyDigest,
146+
KernelMin: rustyKernelMin,
147+
Documentation: rustyDocs,
148+
SourceURL: rustySource,
149+
Version: rustyVersion,
138150
}
139151
var buf bytes.Buffer
140152
info.WriteText(&buf, r)
141153
out := buf.String()
142154

143155
for _, want := range []string{
144-
"scx_rusty",
145-
"Rust user-space scheduler",
146-
"ghcr.io/schedkit/scx_rusty:latest",
147-
"sha256:abc",
148-
"6.12",
149-
"https://example.com/docs",
150-
"https://github.com/sched-ext/scx",
151-
"1.0.0",
156+
rustyName,
157+
rustyDescription,
158+
rustyImage,
159+
rustyDigest,
160+
rustyKernelMin,
161+
rustyDocs,
162+
rustySource,
163+
rustyVersion,
152164
} {
153165
assert.True(t, strings.Contains(out, want), "expected text output to contain %q", want)
154166
}

internal/schedulers/schedulers_test.go

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,12 @@ import (
88
"schedctl/internal/schedulers"
99
)
1010

11+
const rustyRepo = "ghcr.io/schedkit/scx_rusty"
12+
1113
func TestSchedulerFound(t *testing.T) {
1214
result, err := schedulers.GetScheduler("scx_rusty", "")
1315
assert.Nil(t, err)
14-
assert.Equal(t, "ghcr.io/schedkit/scx_rusty:latest", result.ImageURI)
16+
assert.Equal(t, rustyRepo+":latest", result.ImageURI)
1517
assert.Equal(t, schedulers.SourceManifest, result.Source)
1618
}
1719

@@ -65,7 +67,7 @@ func TestInvalidInput(t *testing.T) {
6567
func TestGetSchedulerWithVersion(t *testing.T) {
6668
result, err := schedulers.GetScheduler("scx_rusty", "v1.0.0")
6769
assert.Nil(t, err)
68-
assert.Equal(t, "ghcr.io/schedkit/scx_rusty:v1.0.0", result.ImageURI)
70+
assert.Equal(t, rustyRepo+":v1.0.0", result.ImageURI)
6971
assert.Equal(t, schedulers.SourceManifest, result.Source)
7072
}
7173

@@ -81,9 +83,9 @@ func TestImageRepo(t *testing.T) {
8183
input string
8284
expected string
8385
}{
84-
{"ghcr.io/schedkit/scx_rusty:latest", "ghcr.io/schedkit/scx_rusty"},
85-
{"ghcr.io/schedkit/scx_rusty", "ghcr.io/schedkit/scx_rusty"},
86-
{"ghcr.io/schedkit/scx_rusty@sha256:abc123", "ghcr.io/schedkit/scx_rusty"},
86+
{rustyRepo + ":latest", rustyRepo},
87+
{rustyRepo, rustyRepo},
88+
{rustyRepo + "@sha256:abc123", rustyRepo},
8789
{"localhost:5000/myimage:v1", "localhost:5000/myimage"},
8890
{"docker.io/nginx:alpine", "docker.io/nginx"},
8991
}

0 commit comments

Comments
 (0)