Skip to content

Commit 368a010

Browse files
authored
chore: migrate to go 1.24 (#4538)
1 parent 8d67cdf commit 368a010

File tree

18 files changed

+44
-42
lines changed

18 files changed

+44
-42
lines changed

.github/workflows/coverage.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ jobs:
1515
fetch-depth: 2
1616
- uses: actions/setup-go@v5
1717
with:
18-
go-version: '1.22'
18+
go-version: '1.24'
1919
- name: Run coverage
2020
run: go test -coverprofile=coverage.out -covermode=count ./...
2121
- name: Upload coverage to Codecov

.github/workflows/docs.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ jobs:
1111
- uses: actions/checkout@v4
1212
- uses: actions/setup-go@v5
1313
with:
14-
go-version: '1.22'
14+
go-version: '1.24'
1515
- name: Generate code
1616
run: go run ./cmd/scw-doc-gen
1717
env:

.github/workflows/nightly.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ jobs:
5656
- name: Install Go
5757
uses: actions/setup-go@v5
5858
with:
59-
go-version: 1.22
59+
go-version: 1.24
6060
- name: Run Acceptance Tests
6161
run: go test -v ./internal/namespaces/${{ matrix.products }}/... -timeout=4h
6262
env:
@@ -98,7 +98,7 @@ jobs:
9898
- name: Install Go
9999
uses: actions/setup-go@v5
100100
with:
101-
go-version: 1.22
101+
go-version: 1.24
102102
- name: Run Sweepers
103103
run: go run -v ./cmd/scw-sweeper
104104
env:

.github/workflows/release.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ jobs:
2020
- name: Set up Go
2121
uses: actions/setup-go@v5
2222
with:
23-
go-version: '1.22'
23+
go-version: '1.24'
2424

2525
- name: Run GoReleaser
2626
uses: goreleaser/goreleaser-action@v6
@@ -38,7 +38,7 @@ jobs:
3838
- name: Install Go
3939
uses: actions/setup-go@v5
4040
with:
41-
go-version: '1.22'
41+
go-version: '1.24'
4242
- name: Install pnpm
4343
uses: pnpm/action-setup@v4
4444
with:

.github/workflows/unit-tests.yaml

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ jobs:
88
os-tests:
99
strategy:
1010
matrix:
11-
go-version: [1.22.x]
1211
platform: [ubuntu-latest, macos-latest, windows-latest]
1312
runs-on: ${{ matrix.platform }}
1413
steps:
@@ -24,18 +23,14 @@ jobs:
2423
- name: Install Go
2524
uses: actions/setup-go@v5
2625
with:
27-
go-version: ${{ matrix.go-version }}
26+
go-version: '1.24'
2827
- name: Run unit tests
2928
run: go test ./...
3029
- name: Execute main binary # Test the runtime for potential panics.
3130
run: go run cmd/scw/main.go -h
3231

3332
build-tests:
34-
strategy:
35-
matrix:
36-
go-version: [1.22.x]
37-
platform: [ubuntu-latest]
38-
runs-on: ${{ matrix.platform }}
33+
runs-on: ubuntu-latest
3934
steps:
4035
# Checkout should always be before setup-go to ensure caching is working
4136
- name: Checkout
@@ -45,7 +40,7 @@ jobs:
4540
- name: Install Go
4641
uses: actions/setup-go@v5
4742
with:
48-
go-version: ${{ matrix.go-version }}
43+
go-version: '1.24'
4944
- name: Build binaries
5045
run: ./scripts/build.sh
5146
- name: Print binaries size

.github/workflows/wasm.yml

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,7 @@ on:
66

77
jobs:
88
build-and-test:
9-
strategy:
10-
matrix:
11-
go-version: [1.22.x]
12-
platform: [ubuntu-latest]
13-
runs-on: ${{ matrix.platform }}
9+
runs-on: ubuntu-latest
1410
steps:
1511
# Checkout should always be before setup-go to ensure caching is working
1612
- name: Checkout
@@ -20,7 +16,7 @@ jobs:
2016
- name: Install Go
2117
uses: actions/setup-go@v5
2218
with:
23-
go-version: ${{ matrix.go-version }}
19+
go-version: '1.24'
2420
- name: Install pnpm
2521
uses: pnpm/action-setup@v4
2622
with:

.golangci.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,6 @@ linters:
6262
- staticcheck
6363
- stylecheck # Stylecheck is a replacement for golint [fast: false, auto-fix: false]
6464
- tagalign # check that struct tags are well aligned [fast: true, auto-fix: true]
65-
- tenv # tenv is analyzer that detects using os.Setenv instead of t.Setenv since Go1.17 [fast: false, auto-fix: false]
6665
- testifylint # Checks usage of github.com/stretchr/testify. [fast: false, auto-fix: false]
6766
- testpackage # linter that makes you use a separate _test package [fast: true, auto-fix: false]
6867
- thelper # thelper detects golang test helpers without t.Helper() call and checks the consistency of test helpers [fast: false, auto-fix: false]

Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM golang:1.23-alpine3.19 AS builder
1+
FROM golang:1.24-alpine3.21 AS builder
22

33
ENV BUILD_IN_DOCKER true
44
ARG VERSION

core/autocomplete_test.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ func runAutocompleteTest(ctx context.Context, tc *autoCompleteTestCase) func(*te
114114
}
115115

116116
func TestAutocomplete(t *testing.T) {
117-
ctx := core.InjectMeta(context.Background(), &core.Meta{
117+
ctx := core.InjectMeta(t.Context(), &core.Meta{
118118
Commands: testAutocompleteGetCommands(),
119119
})
120120

@@ -253,7 +253,7 @@ func TestAutocompleteArgs(t *testing.T) {
253253
}, nil
254254
},
255255
})
256-
ctx := core.InjectMeta(context.Background(), &core.Meta{
256+
ctx := core.InjectMeta(t.Context(), &core.Meta{
257257
Commands: commands,
258258
BetaMode: true,
259259
})
@@ -272,7 +272,7 @@ func TestAutocompleteArgs(t *testing.T) {
272272

273273
func TestAutocompleteProfiles(t *testing.T) {
274274
commands := testAutocompleteGetCommands()
275-
ctx := core.InjectMeta(context.Background(), &core.Meta{
275+
ctx := core.InjectMeta(t.Context(), &core.Meta{
276276
Commands: commands,
277277
BetaMode: true,
278278
Platform: terminal.NewPlatform(""),
@@ -300,7 +300,7 @@ func TestAutocompleteProfiles(t *testing.T) {
300300
}
301301

302302
func TestAutocompleteDeprecatedCommand(t *testing.T) {
303-
ctx := core.InjectMeta(context.Background(), &core.Meta{
303+
ctx := core.InjectMeta(t.Context(), &core.Meta{
304304
Commands: testAutocompleteGetCommands(),
305305
})
306306

core/cobra_usage_builder_test.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
package core_test
22

33
import (
4-
"context"
54
"reflect"
65
"testing"
76

@@ -41,7 +40,7 @@ func Test_buildUsageArgs(t *testing.T) {
4140
[root-volume.name] Root volume name
4241
[additional-volumes.{index}.name] Additional volume name`
4342

44-
got := core.BuildUsageArgs(context.Background(), &core.Command{
43+
got := core.BuildUsageArgs(t.Context(), &core.Command{
4544
ArgsType: reflect.TypeOf(instanceListServerArgs{}),
4645
ArgSpecs: core.ArgSpecs{
4746
{

0 commit comments

Comments
 (0)