Skip to content

Commit 81f15bb

Browse files
authored
Merge pull request #2040 from andyzhangx/fix-golint-1.22
[release-1.22] test: fix golint errors
2 parents d7bd26e + 6ce9723 commit 81f15bb

File tree

6 files changed

+25
-22
lines changed

6 files changed

+25
-22
lines changed

.github/workflows/static.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,5 +15,5 @@ jobs:
1515
- name: Run linter
1616
uses: golangci/golangci-lint-action@v3
1717
with:
18-
version: v1.60
19-
args: -E=gofmt,unused,ineffassign,revive,misspell,exportloopref,asciicheck,bodyclose,depguard,dogsled,durationcheck,errname,forbidigo -D=staticcheck --timeout=30m0s
18+
version: v1.64
19+
args: -E=gofmt,unused,ineffassign,revive,misspell,asciicheck,bodyclose,dogsled,durationcheck,errname,forbidigo -D=staticcheck --timeout=30m0s

.github/workflows/trivy.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ jobs:
1212
- name: Set up Go 1.x
1313
uses: actions/setup-go@v4
1414
with:
15-
go-version: 1.23.8
15+
go-version: 1.24.4
1616
id: go
1717

1818
- name: Checkout code

.trivyignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,5 @@
11
CVE-2024-9042
22
CVE-2025-0426
3+
CVE-2025-22874
4+
CVE-2025-4673
5+
CVE-2025-0913

pkg/csi-common/driver.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,8 +65,8 @@ func (d *CSIDriver) ValidateControllerServiceRequest(c csi.ControllerServiceCapa
6565
return nil
6666
}
6767

68-
for _, cap := range d.Cap {
69-
if c == cap.GetRpc().GetType() {
68+
for _, capability := range d.Cap {
69+
if c == capability.GetRpc().GetType() {
7070
return nil
7171
}
7272
}

pkg/csi-common/utils.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -41,21 +41,21 @@ func NewVolumeCapabilityAccessMode(mode csi.VolumeCapability_AccessMode_Mode) *c
4141
return &csi.VolumeCapability_AccessMode{Mode: mode}
4242
}
4343

44-
func NewControllerServiceCapability(cap csi.ControllerServiceCapability_RPC_Type) *csi.ControllerServiceCapability {
44+
func NewControllerServiceCapability(c csi.ControllerServiceCapability_RPC_Type) *csi.ControllerServiceCapability {
4545
return &csi.ControllerServiceCapability{
4646
Type: &csi.ControllerServiceCapability_Rpc{
4747
Rpc: &csi.ControllerServiceCapability_RPC{
48-
Type: cap,
48+
Type: c,
4949
},
5050
},
5151
}
5252
}
5353

54-
func NewNodeServiceCapability(cap csi.NodeServiceCapability_RPC_Type) *csi.NodeServiceCapability {
54+
func NewNodeServiceCapability(c csi.NodeServiceCapability_RPC_Type) *csi.NodeServiceCapability {
5555
return &csi.NodeServiceCapability{
5656
Type: &csi.NodeServiceCapability_Rpc{
5757
Rpc: &csi.NodeServiceCapability_RPC{
58-
Type: cap,
58+
Type: c,
5959
},
6060
},
6161
}

pkg/csi-common/utils_test.go

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -139,50 +139,50 @@ func TestLogGRPC(t *testing.T) {
139139

140140
func TestNewControllerServiceCapability(t *testing.T) {
141141
tests := []struct {
142-
cap csi.ControllerServiceCapability_RPC_Type
142+
c csi.ControllerServiceCapability_RPC_Type
143143
}{
144144
{
145-
cap: csi.ControllerServiceCapability_RPC_UNKNOWN,
145+
c: csi.ControllerServiceCapability_RPC_UNKNOWN,
146146
},
147147
{
148-
cap: csi.ControllerServiceCapability_RPC_CREATE_DELETE_VOLUME,
148+
c: csi.ControllerServiceCapability_RPC_CREATE_DELETE_VOLUME,
149149
},
150150
{
151-
cap: csi.ControllerServiceCapability_RPC_PUBLISH_UNPUBLISH_VOLUME,
151+
c: csi.ControllerServiceCapability_RPC_PUBLISH_UNPUBLISH_VOLUME,
152152
},
153153
{
154-
cap: csi.ControllerServiceCapability_RPC_LIST_VOLUMES,
154+
c: csi.ControllerServiceCapability_RPC_LIST_VOLUMES,
155155
},
156156
{
157-
cap: csi.ControllerServiceCapability_RPC_GET_CAPACITY,
157+
c: csi.ControllerServiceCapability_RPC_GET_CAPACITY,
158158
},
159159
}
160160
for _, test := range tests {
161-
resp := NewControllerServiceCapability(test.cap)
161+
resp := NewControllerServiceCapability(test.c)
162162
assert.NotNil(t, resp)
163163
assert.Equal(t, resp.XXX_sizecache, int32(0))
164164
}
165165
}
166166

167167
func TestNewNodeServiceCapability(t *testing.T) {
168168
tests := []struct {
169-
cap csi.NodeServiceCapability_RPC_Type
169+
c csi.NodeServiceCapability_RPC_Type
170170
}{
171171
{
172-
cap: csi.NodeServiceCapability_RPC_UNKNOWN,
172+
c: csi.NodeServiceCapability_RPC_UNKNOWN,
173173
},
174174
{
175-
cap: csi.NodeServiceCapability_RPC_STAGE_UNSTAGE_VOLUME,
175+
c: csi.NodeServiceCapability_RPC_STAGE_UNSTAGE_VOLUME,
176176
},
177177
{
178-
cap: csi.NodeServiceCapability_RPC_GET_VOLUME_STATS,
178+
c: csi.NodeServiceCapability_RPC_GET_VOLUME_STATS,
179179
},
180180
{
181-
cap: csi.NodeServiceCapability_RPC_EXPAND_VOLUME,
181+
c: csi.NodeServiceCapability_RPC_EXPAND_VOLUME,
182182
},
183183
}
184184
for _, test := range tests {
185-
resp := NewNodeServiceCapability(test.cap)
185+
resp := NewNodeServiceCapability(test.c)
186186
assert.NotNil(t, resp)
187187
assert.Equal(t, resp.XXX_sizecache, int32(0))
188188
}

0 commit comments

Comments
 (0)