Merge pull request #895 from andyzhangx/go1.24

chore: use go1.24
This commit is contained in:
Andy Zhang 2025-04-03 09:31:43 +08:00 committed by GitHub
commit 6477d17e03
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
7 changed files with 17 additions and 22 deletions

View File

@ -15,8 +15,8 @@ jobs:
- name: Run linter - name: Run linter
uses: golangci/golangci-lint-action@v6 uses: golangci/golangci-lint-action@v6
with: with:
version: v1.60 version: v1.64
args: -E=gofmt,unused,ineffassign,revive,misspell,exportloopref,asciicheck,bodyclose,contextcheck --timeout=30m0s args: -E=gofmt,unused,ineffassign,revive,misspell,copyloopvar,asciicheck,bodyclose,contextcheck --timeout=30m0s
verify-helm: verify-helm:
name: Verify Helm name: Verify Helm
runs-on: ubuntu-latest runs-on: ubuntu-latest

2
go.mod
View File

@ -1,6 +1,6 @@
module github.com/kubernetes-csi/csi-driver-nfs module github.com/kubernetes-csi/csi-driver-nfs
go 1.23.1 go 1.24
require ( require (
github.com/container-storage-interface/spec v1.11.0 github.com/container-storage-interface/spec v1.11.0

View File

@ -800,7 +800,7 @@ func getNfsVolFromID(id string) (*nfsVolume, error) {
// try with separator "/" // try with separator "/"
volRegex := regexp.MustCompile("^([^/]+)/(.*)/([^/]+)$") volRegex := regexp.MustCompile("^([^/]+)/(.*)/([^/]+)$")
tokens := volRegex.FindStringSubmatch(id) tokens := volRegex.FindStringSubmatch(id)
if tokens == nil || len(tokens) < 4 { if len(tokens) < 4 {
return nil, fmt.Errorf("could not split %s into server, baseDir and subDir with separator(%s)", id, "/") return nil, fmt.Errorf("could not split %s into server, baseDir and subDir with separator(%s)", id, "/")
} }
server = tokens[1] server = tokens[1]

View File

@ -218,7 +218,6 @@ func TestCreateVolume(t *testing.T) {
} }
for _, test := range cases { for _, test := range cases {
test := test //pin
t.Run(test.name, func(t *testing.T) { t.Run(test.name, func(t *testing.T) {
// Setup // Setup
cs := initTestController(t) cs := initTestController(t)
@ -300,7 +299,6 @@ func TestDeleteVolume(t *testing.T) {
} }
for _, test := range cases { for _, test := range cases {
test := test //pin
if runtime.GOOS == "windows" && !test.testOnWindows { if runtime.GOOS == "windows" && !test.testOnWindows {
continue continue
} }
@ -386,7 +384,6 @@ func TestControllerGetCapabilities(t *testing.T) {
} }
for _, test := range cases { for _, test := range cases {
test := test //pin
t.Run(test.desc, func(t *testing.T) { t.Run(test.desc, func(t *testing.T) {
// Setup // Setup
cs := initTestController(t) cs := initTestController(t)
@ -526,7 +523,6 @@ func TestNfsVolFromId(t *testing.T) {
} }
for _, test := range cases { for _, test := range cases {
test := test //pin
t.Run(test.name, func(t *testing.T) { t.Run(test.name, func(t *testing.T) {
resp, err := getNfsVolFromID(test.volumeID) resp, err := getNfsVolFromID(test.volumeID)

View File

@ -67,21 +67,21 @@ func NewControllerServer(d *Driver) *ControllerServer {
} }
} }
func NewControllerServiceCapability(cap csi.ControllerServiceCapability_RPC_Type) *csi.ControllerServiceCapability { func NewControllerServiceCapability(c csi.ControllerServiceCapability_RPC_Type) *csi.ControllerServiceCapability {
return &csi.ControllerServiceCapability{ return &csi.ControllerServiceCapability{
Type: &csi.ControllerServiceCapability_Rpc{ Type: &csi.ControllerServiceCapability_Rpc{
Rpc: &csi.ControllerServiceCapability_RPC{ Rpc: &csi.ControllerServiceCapability_RPC{
Type: cap, Type: c,
}, },
}, },
} }
} }
func NewNodeServiceCapability(cap csi.NodeServiceCapability_RPC_Type) *csi.NodeServiceCapability { func NewNodeServiceCapability(c csi.NodeServiceCapability_RPC_Type) *csi.NodeServiceCapability {
return &csi.NodeServiceCapability{ return &csi.NodeServiceCapability{
Type: &csi.NodeServiceCapability_Rpc{ Type: &csi.NodeServiceCapability_Rpc{
Rpc: &csi.NodeServiceCapability_RPC{ Rpc: &csi.NodeServiceCapability_RPC{
Type: cap, Type: c,
}, },
}, },
} }

View File

@ -65,7 +65,6 @@ func TestParseEndpoint(t *testing.T) {
} }
for _, test := range cases { for _, test := range cases {
test := test //pin
t.Run(test.desc, func(t *testing.T) { t.Run(test.desc, func(t *testing.T) {
proto, addr, err := ParseEndpoint(test.endpoint) proto, addr, err := ParseEndpoint(test.endpoint)

View File

@ -86,7 +86,7 @@ configvar CSI_PROW_BUILD_PLATFORMS "linux amd64 amd64; linux ppc64le ppc64le -pp
# which is disabled with GOFLAGS=-mod=vendor). # which is disabled with GOFLAGS=-mod=vendor).
configvar GOFLAGS_VENDOR "$( [ -d vendor ] && echo '-mod=vendor' )" "Go flags for using the vendor directory" configvar GOFLAGS_VENDOR "$( [ -d vendor ] && echo '-mod=vendor' )" "Go flags for using the vendor directory"
configvar CSI_PROW_GO_VERSION_BUILD "1.23.6" "Go version for building the component" # depends on component's source code configvar CSI_PROW_GO_VERSION_BUILD "1.24.0" "Go version for building the component" # depends on component's source code
configvar CSI_PROW_GO_VERSION_E2E "" "override Go version for building the Kubernetes E2E test suite" # normally doesn't need to be set, see install_e2e configvar CSI_PROW_GO_VERSION_E2E "" "override Go version for building the Kubernetes E2E test suite" # normally doesn't need to be set, see install_e2e
configvar CSI_PROW_GO_VERSION_SANITY "${CSI_PROW_GO_VERSION_BUILD}" "Go version for building the csi-sanity test suite" # depends on CSI_PROW_SANITY settings below configvar CSI_PROW_GO_VERSION_SANITY "${CSI_PROW_GO_VERSION_BUILD}" "Go version for building the csi-sanity test suite" # depends on CSI_PROW_SANITY settings below
configvar CSI_PROW_GO_VERSION_KIND "${CSI_PROW_GO_VERSION_BUILD}" "Go version for building 'kind'" # depends on CSI_PROW_KIND_VERSION below configvar CSI_PROW_GO_VERSION_KIND "${CSI_PROW_GO_VERSION_BUILD}" "Go version for building 'kind'" # depends on CSI_PROW_KIND_VERSION below
@ -144,7 +144,7 @@ kind_version_default () {
latest|master) latest|master)
echo main;; echo main;;
*) *)
echo v0.14.0;; echo v0.25.0;;
esac esac
} }
@ -155,13 +155,13 @@ configvar CSI_PROW_KIND_VERSION "$(kind_version_default)" "kind"
# kind images to use. Must match the kind version. # kind images to use. Must match the kind version.
# The release notes of each kind release list the supported images. # The release notes of each kind release list the supported images.
configvar CSI_PROW_KIND_IMAGES "kindest/node:v1.24.0@sha256:0866296e693efe1fed79d5e6c7af8df71fc73ae45e3679af05342239cdc5bc8e configvar CSI_PROW_KIND_IMAGES "kindest/node:v1.32.0@sha256:2458b423d635d7b01637cac2d6de7e1c1dca1148a2ba2e90975e214ca849e7cb
kindest/node:v1.23.6@sha256:b1fa224cc6c7ff32455e0b1fd9cbfd3d3bc87ecaa8fcb06961ed1afb3db0f9ae kindest/node:v1.31.2@sha256:18fbefc20a7113353c7b75b5c869d7145a6abd6269154825872dc59c1329912e
kindest/node:v1.22.9@sha256:8135260b959dfe320206eb36b3aeda9cffcb262f4b44cda6b33f7bb73f453105 kindest/node:v1.30.6@sha256:b6d08db72079ba5ae1f4a88a09025c0a904af3b52387643c285442afb05ab994
kindest/node:v1.21.12@sha256:f316b33dd88f8196379f38feb80545ef3ed44d9197dca1bfd48bcb1583210207 kindest/node:v1.29.10@sha256:3b2d8c31753e6c8069d4fc4517264cd20e86fd36220671fb7d0a5855103aa84b
kindest/node:v1.20.15@sha256:6f2d011dffe182bad80b85f6c00e8ca9d86b5b8922cdf433d53575c4c5212248 kindest/node:v1.28.15@sha256:a7c05c7ae043a0b8c818f5a06188bc2c4098f6cb59ca7d1856df00375d839251
kindest/node:v1.19.16@sha256:d9c819e8668de8d5030708e484a9fdff44d95ec4675d136ef0a0a584e587f65c kindest/node:v1.27.16@sha256:2d21a61643eafc439905e18705b8186f3296384750a835ad7a005dceb9546d20
kindest/node:v1.18.20@sha256:738cdc23ed4be6cc0b7ea277a2ebcc454c8373d7d8fb991a7fcdbd126188e6d7" "kind images" kindest/node:v1.26.15@sha256:c79602a44b4056d7e48dc20f7504350f1e87530fe953428b792def00bc1076dd" "kind images"
# By default, this script tests sidecars with the CSI hostpath driver, # By default, this script tests sidecars with the CSI hostpath driver,
# using the install_csi_driver function. That function depends on # using the install_csi_driver function. That function depends on