Skip to content

Commit 1fd8a6f

Browse files
Update go version to 1.24
Signed-off-by: Meghna Singh <[email protected]>
1 parent 3ff1e6f commit 1fd8a6f

File tree

96 files changed

+1221
-1194
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

96 files changed

+1221
-1194
lines changed

.github/workflows/github-actions.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
name: checks
22
env:
3-
GO_VERSION: '1.23'
3+
GO_VERSION: '1.24'
44
on:
55
pull_request:
66
branches:
@@ -42,8 +42,8 @@ jobs:
4242
- name: golangci-lint
4343
# Switch back to the official action after this bug is fixed: https://github.com/golangci/golangci-lint/issues/3107
4444
run: |
45-
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin v1.61.0
46-
$(go env GOPATH)/bin/golangci-lint run --out-format=github-actions --timeout=15m --verbose
45+
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin v2.1.6
46+
$(go env GOPATH)/bin/golangci-lint run --output.text.path=github-actions --timeout=15m --verbose
4747
go-mod-tidy:
4848
name: go mod tidy
4949
runs-on: ubuntu-latest

.golangci.yml

Lines changed: 53 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -1,55 +1,58 @@
1+
version: "2"
12
run:
2-
timeout: 5m
3-
go: 1.23
4-
3+
go: "1.24"
54
linters:
6-
disable-all: true
7-
# Enable specific linter
8-
# https://golangci-lint.run/usage/linters/#enabled-by-default-linters
5+
default: none
96
enable:
10-
- gofumpt
11-
- goimports
12-
- govet
137
- errcheck
148
- gosec
15-
16-
issues:
17-
exclude-rules:
18-
# Exclude some linters from running on tests files.
19-
- path: _test\.go
20-
linters:
21-
- gocyclo
22-
- errcheck
23-
- dupl
24-
- gosec
25-
# Exclude `lll` issues for long lines with `go:generate`.
26-
- linters:
27-
- lll
28-
source: "^//go:generate "
29-
30-
linters-settings:
31-
gofumpt:
32-
extra-rules: true
33-
module-path: github.com/netapp/trident
34-
35-
goimports:
36-
# Put imports beginning with prefix after 3rd-party packages.
37-
# It's a comma-separated list of prefixes.
38-
local-prefixes: github.com/netapp/trident
39-
40-
lll:
41-
# Max line length, lines longer will be reported.
42-
# '\t' is counted as 1 character by default, and can be changed with the tab-width option.
43-
line-length: 120
44-
# Tab width in spaces.
45-
tab-width: 4
46-
47-
gosec:
48-
excludes:
49-
# Exclude TLS client side erorrs for now, until Trident fully supports TLS1.3
50-
- G402 # Look for bad TLS connection settings
51-
- G115
52-
53-
govet:
54-
disable:
55-
- printf
9+
- govet
10+
settings:
11+
gosec:
12+
excludes:
13+
- G402
14+
- G115
15+
govet:
16+
disable:
17+
- printf
18+
lll:
19+
line-length: 120
20+
tab-width: 4
21+
exclusions:
22+
generated: lax
23+
presets:
24+
- comments
25+
- common-false-positives
26+
- legacy
27+
- std-error-handling
28+
rules:
29+
- linters:
30+
- dupl
31+
- errcheck
32+
- gocyclo
33+
- gosec
34+
path: _test\.go
35+
- linters:
36+
- lll
37+
source: '^//go:generate '
38+
paths:
39+
- third_party$
40+
- builtin$
41+
- examples$
42+
formatters:
43+
enable:
44+
- gofumpt
45+
- goimports
46+
settings:
47+
gofumpt:
48+
module-path: github.com/netapp/trident
49+
extra-rules: true
50+
goimports:
51+
local-prefixes:
52+
- github.com/netapp/trident
53+
exclusions:
54+
generated: lax
55+
paths:
56+
- third_party$
57+
- builtin$
58+
- examples$

BUILD.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,13 @@
66

77
* Docker-compatible container cli, such as nerdctl or docker
88
* Make, if not building natively or with linker flags
9-
* Go 1.23 or greater, to optionally build Trident natively
9+
* Go 1.24 or greater, to optionally build Trident natively
1010

1111
### Multi-Platform
1212

1313
* Make
1414
* Docker
15-
* Go 1.23 or greater, to optionally build Trident binaries natively
15+
* Go 1.24 or greater, to optionally build Trident binaries natively
1616
* jq
1717

1818
## Makefile Parameters
@@ -32,7 +32,7 @@ Container registry used to tag images and manifests, and optionally to push imag
3232

3333
`GO_IMAGE`
3434

35-
Default: `golang:1.23`
35+
Default: `golang:1.24`
3636

3737
Container image used by default `$GO_SHELL` to run binary build scripts.
3838

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ REGISTRY ?= $(DEFAULT_REGISTRY)
1414
BUILDX_OUTPUT ?= load
1515

1616
# GO_IMAGE golang image used in default GO_SHELL
17-
GO_IMAGE ?= golang:1.23
17+
GO_IMAGE ?= golang:1.24
1818

1919
# GO_CMD go command used for go build
2020
GO_CMD ?= go

acp/client.go

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ package acp
44

55
import (
66
"context"
7-
"fmt"
87
"time"
98

109
"github.com/cenkalti/backoff/v4"
@@ -75,7 +74,7 @@ func (c *client) GetVersion(ctx context.Context) (*version.Version, error) {
7574

7675
if acpVersion == nil {
7776
Logc(ctx).Error("No version in response from Trident-ACP REST API.")
78-
return nil, fmt.Errorf("no version in response from Trident-ACP REST API")
77+
return nil, errors.New("no version in response from Trident-ACP REST API")
7978
}
8079

8180
Logc(ctx).WithField("version", acpVersion.String()).Debug("Received Trident-ACP version.")
@@ -116,7 +115,7 @@ func (c *client) GetVersionWithBackoff(ctx context.Context) (*version.Version, e
116115
return nil, err
117116
} else if v == nil {
118117
Logc(ctx).Error("No version in response from Trident-ACP REST API.")
119-
return nil, fmt.Errorf("no version in response from Trident-ACP REST API")
118+
return nil, errors.New("no version in response from Trident-ACP REST API")
120119
}
121120

122121
Logc(ctx).WithField("version", v.String()).Debug("The Trident-ACP REST API is responsive.")

cli/cmd/check_operator_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
package cmd
44

55
import (
6-
"fmt"
76
"io"
87
"os"
98
"testing"
@@ -15,6 +14,7 @@ import (
1514

1615
"github.com/netapp/trident/cli/api"
1716
mockexec "github.com/netapp/trident/mocks/mock_utils/mock_exec"
17+
"github.com/netapp/trident/utils/errors"
1818
execCmd "github.com/netapp/trident/utils/exec"
1919
)
2020

@@ -89,7 +89,7 @@ func TestCheckOperatorStatus_RequestError(t *testing.T) {
8989
defer httpmock.DeactivateAndReset()
9090

9191
httpmock.RegisterResponder("GET", url,
92-
httpmock.NewErrorResponder(fmt.Errorf("random error")))
92+
httpmock.NewErrorResponder(errors.New("random error")))
9393

9494
err := checkOperatorStatus(1)
9595

cli/cmd/update_backend_state.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ func validateUpdateBackendStateArguments(cmd *cobra.Command, args []string) erro
5151
}
5252

5353
if flagSet != 1 {
54-
return fmt.Errorf("exactly one of --state or --user-state must be specified")
54+
return errors.New("exactly one of --state or --user-state must be specified")
5555
}
5656

5757
return nil

cli/cmd/update_backend_state_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ package cmd
44

55
import (
66
"bytes"
7-
"fmt"
87
"io"
98
"net/http"
109
"os"
@@ -21,6 +20,7 @@ import (
2120
"github.com/netapp/trident/frontend/rest"
2221
mockexec "github.com/netapp/trident/mocks/mock_utils/mock_exec"
2322
"github.com/netapp/trident/storage"
23+
"github.com/netapp/trident/utils/errors"
2424
execCmd "github.com/netapp/trident/utils/exec"
2525
)
2626

@@ -393,7 +393,7 @@ func TestUpdateBackendState(t *testing.T) {
393393
urlUpdateBackendResponse: BaseURL() + "/backend/" + backends[0].Name + "/state",
394394
urlGetBackendResponse: BaseURL() + "/backend/" + backends[0].Name,
395395
updateBackendResponse: func(req *http.Request) (*http.Response, error) {
396-
return nil, fmt.Errorf("trident server not found")
396+
return nil, errors.New("trident server not found")
397397
},
398398
matchOutput: false,
399399
},

cli/k8s_client/feature_gate.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ func (g autoFeatureGate) Gates() map[string]string {
9191
// If some but not all feature gates are safe to enable, they will be returned along with an error.
9292
func ConstructCSIFeatureGateYAMLSnippets(client KubernetesClient) (map[string]string, error) {
9393
if client == nil {
94-
return nil, fmt.Errorf("k8s API client is nil; cannot auto-enable feature gates")
94+
return nil, errors.New("k8s API client is nil; cannot auto-enable feature gates")
9595
}
9696

9797
// Automatically enable feature gates.

cli/k8s_client/k8s_client_test.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ package k8sclient
44

55
import (
66
"encoding/json"
7-
"fmt"
87
"io"
98
"os"
109
"testing"
@@ -22,7 +21,7 @@ import (
2221
"github.com/netapp/trident/utils/errors"
2322
)
2423

25-
var mockError = fmt.Errorf("mock error")
24+
var mockError = errors.New("mock error")
2625

2726
func TestMain(m *testing.M) {
2827
// Disable any standard log output

0 commit comments

Comments
 (0)