Skip to content

Commit d4c4b24

Browse files
Upgrade go version to 1.24 (#128)
* upgrade go version to 1.24 * update lint ci * update golangci-lint version * fix lint errors * update
1 parent c60697e commit d4c4b24

File tree

6 files changed

+25
-12
lines changed

6 files changed

+25
-12
lines changed

.github/workflows/ci.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ jobs:
1919
- name: Set up Go
2020
uses: actions/setup-go@v4
2121
with:
22-
go-version: '1.23'
22+
go-version: '1.24'
2323
- name: Run Build
2424
run: go build -o ./out/manager ./cmd/main.go
2525
- name: Run Test

.github/workflows/golangci-lint.yml

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,8 @@ jobs:
2222
- uses: actions/checkout@v4
2323
- uses: actions/setup-go@v5
2424
with:
25-
go-version: 1.23.1
25+
go-version: 1.24.0
2626
- name: golangci-lint
27-
uses: golangci/golangci-lint-action@v6
27+
uses: golangci/golangci-lint-action@v8
2828
with:
29-
version: v1.61.0
30-
args: --timeout 10m
29+
args: --timeout 10m --disable staticcheck

Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# Build the manager binary
2-
FROM --platform=$BUILDPLATFORM mcr.microsoft.com/oss/go/microsoft/golang:1.23-cbl-mariner2.0 AS builder
2+
FROM --platform=$BUILDPLATFORM mcr.microsoft.com/oss/go/microsoft/golang:1.24-cbl-mariner2.0 AS builder
33

44
ARG MODULE_VERSION
55
WORKDIR /workspace

go.mod

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

3-
go 1.23.0
3+
go 1.24.0
44

55
require (
66
github.com/Azure/azure-sdk-for-go/sdk/azcore v1.18.2

internal/controller/utils_test.go

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -955,11 +955,17 @@ func TestVerifyAuthObject(t *testing.T) {
955955

956956
// Cleanup after tests
957957
defer func() {
958-
os.Setenv("WORKLOAD_IDENTITY_ENABLED", originalWIEnabled)
958+
err := os.Setenv("WORKLOAD_IDENTITY_ENABLED", originalWIEnabled)
959+
if err != nil {
960+
t.Errorf("Failed to restore environment variable: %v", err)
961+
}
959962
}()
960963

961964
t.Run("Should return no error if auth object is valid", func(t *testing.T) {
962-
os.Setenv("WORKLOAD_IDENTITY_ENABLED", "true")
965+
err := os.Setenv("WORKLOAD_IDENTITY_ENABLED", "true")
966+
if err != nil {
967+
t.Errorf("Failed to set environment variable: %v", err)
968+
}
963969

964970
uuid1 := "86c613ca-b977-11ed-afa1-0242ac120002"
965971
secretName := "fakeName1"
@@ -1008,7 +1014,9 @@ func TestVerifyAuthObject(t *testing.T) {
10081014
})
10091015

10101016
t.Run("Should return error if auth object is not valid", func(t *testing.T) {
1011-
os.Setenv("WORKLOAD_IDENTITY_ENABLED", "true")
1017+
if err := os.Setenv("WORKLOAD_IDENTITY_ENABLED", "true"); err != nil {
1018+
t.Errorf("Failed to set environment variable: %v", err)
1019+
}
10121020

10131021
uuid1 := "not-a-uuid"
10141022
uuid2 := "86c613ca-b977-11ed-afa1-0242ac120002"

internal/loader/request_tracing_test.go

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -138,8 +138,14 @@ func TestCreateCorrelationContextHeader(t *testing.T) {
138138
// Setup environment variables
139139
if tt.envVars != nil {
140140
for k, v := range tt.envVars {
141-
os.Setenv(k, v)
142-
defer os.Unsetenv(k)
141+
if err := os.Setenv(k, v); err != nil {
142+
t.Errorf("Failed to set environment variable: %v", err)
143+
}
144+
defer func() {
145+
if err := os.Unsetenv(k); err != nil {
146+
t.Errorf("Failed to unset environment variable: %v", err)
147+
}
148+
}()
143149
}
144150
}
145151

0 commit comments

Comments
 (0)