Skip to content

Commit bf0f7ff

Browse files
authored
Merge pull request #2617 from kubernetes-sigs/fix-golint-1.31
[release-1.31] test: fix golint errors
2 parents fa7e824 + e761e76 commit bf0f7ff

File tree

5 files changed

+28
-28
lines changed

5 files changed

+28
-28
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@v6
1717
with:
18-
version: v1.60
19-
args: -E=gofmt,unused,ineffassign,revive,misspell,copyloopvar,asciicheck,bodyclose,depguard,dogsled,dupl,durationcheck,errname,forbidigo -D=staticcheck --timeout=30m0s
18+
version: v1.64
19+
args: -E=gofmt,unused,ineffassign,revive,misspell,copyloopvar,asciicheck,bodyclose,dogsled,dupl,durationcheck,errname,forbidigo -D=staticcheck --timeout=30m0s

pkg/azurefile/controllerserver.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1353,16 +1353,16 @@ func isValidVolumeCapabilities(volCaps []*csi.VolumeCapability) error {
13531353
if len(volCaps) == 0 {
13541354
return fmt.Errorf("CreateVolume Volume capabilities must be provided")
13551355
}
1356-
hasSupport := func(cap *csi.VolumeCapability) error {
1357-
if blk := cap.GetBlock(); blk != nil {
1356+
hasSupport := func(capability *csi.VolumeCapability) error {
1357+
if blk := capability.GetBlock(); blk != nil {
13581358
return fmt.Errorf("driver does not support block volumes")
13591359
}
13601360
for _, c := range volumeCaps {
1361-
if c.GetMode() == cap.AccessMode.GetMode() {
1361+
if c.GetMode() == capability.AccessMode.GetMode() {
13621362
return nil
13631363
}
13641364
}
1365-
return fmt.Errorf("driver does not support access mode %v", cap.AccessMode.GetMode())
1365+
return fmt.Errorf("driver does not support access mode %v", capability.AccessMode.GetMode())
13661366
}
13671367

13681368
for _, c := range volCaps {

pkg/csi-common/driver.go

Lines changed: 4 additions & 4 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
}
@@ -78,8 +78,8 @@ func (d *CSIDriver) ValidateNodeServiceRequest(c csi.NodeServiceCapability_RPC_T
7878
return nil
7979
}
8080

81-
for _, cap := range d.NSCap {
82-
if c == cap.GetRpc().GetType() {
81+
for _, capability := range d.NSCap {
82+
if c == capability.GetRpc().GetType() {
8383
return nil
8484
}
8585
}

pkg/csi-common/utils.go

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

70-
func NewControllerServiceCapability(cap csi.ControllerServiceCapability_RPC_Type) *csi.ControllerServiceCapability {
70+
func NewControllerServiceCapability(c csi.ControllerServiceCapability_RPC_Type) *csi.ControllerServiceCapability {
7171
return &csi.ControllerServiceCapability{
7272
Type: &csi.ControllerServiceCapability_Rpc{
7373
Rpc: &csi.ControllerServiceCapability_RPC{
74-
Type: cap,
74+
Type: c,
7575
},
7676
},
7777
}
7878
}
7979

80-
func NewNodeServiceCapability(cap csi.NodeServiceCapability_RPC_Type) *csi.NodeServiceCapability {
80+
func NewNodeServiceCapability(c csi.NodeServiceCapability_RPC_Type) *csi.NodeServiceCapability {
8181
return &csi.NodeServiceCapability{
8282
Type: &csi.NodeServiceCapability_Rpc{
8383
Rpc: &csi.NodeServiceCapability_RPC{
84-
Type: cap,
84+
Type: c,
8585
},
8686
},
8787
}

pkg/csi-common/utils_test.go

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -218,52 +218,52 @@ func TestNewVolumeCapabilityAccessMode(t *testing.T) {
218218

219219
func TestNewControllerServiceCapability(t *testing.T) {
220220
tests := []struct {
221-
cap csi.ControllerServiceCapability_RPC_Type
221+
c csi.ControllerServiceCapability_RPC_Type
222222
}{
223223
{
224-
cap: csi.ControllerServiceCapability_RPC_UNKNOWN,
224+
c: csi.ControllerServiceCapability_RPC_UNKNOWN,
225225
},
226226
{
227-
cap: csi.ControllerServiceCapability_RPC_CREATE_DELETE_VOLUME,
227+
c: csi.ControllerServiceCapability_RPC_CREATE_DELETE_VOLUME,
228228
},
229229
{
230-
cap: csi.ControllerServiceCapability_RPC_PUBLISH_UNPUBLISH_VOLUME,
230+
c: csi.ControllerServiceCapability_RPC_PUBLISH_UNPUBLISH_VOLUME,
231231
},
232232
{
233-
cap: csi.ControllerServiceCapability_RPC_LIST_VOLUMES,
233+
c: csi.ControllerServiceCapability_RPC_LIST_VOLUMES,
234234
},
235235
{
236-
cap: csi.ControllerServiceCapability_RPC_GET_CAPACITY,
236+
c: csi.ControllerServiceCapability_RPC_GET_CAPACITY,
237237
},
238238
{
239-
cap: csi.ControllerServiceCapability_RPC_CLONE_VOLUME,
239+
c: csi.ControllerServiceCapability_RPC_CLONE_VOLUME,
240240
},
241241
}
242242
for _, test := range tests {
243-
resp := NewControllerServiceCapability(test.cap)
243+
resp := NewControllerServiceCapability(test.c)
244244
assert.NotNil(t, resp)
245245
}
246246
}
247247

248248
func TestNewNodeServiceCapability(t *testing.T) {
249249
tests := []struct {
250-
cap csi.NodeServiceCapability_RPC_Type
250+
c csi.NodeServiceCapability_RPC_Type
251251
}{
252252
{
253-
cap: csi.NodeServiceCapability_RPC_UNKNOWN,
253+
c: csi.NodeServiceCapability_RPC_UNKNOWN,
254254
},
255255
{
256-
cap: csi.NodeServiceCapability_RPC_STAGE_UNSTAGE_VOLUME,
256+
c: csi.NodeServiceCapability_RPC_STAGE_UNSTAGE_VOLUME,
257257
},
258258
{
259-
cap: csi.NodeServiceCapability_RPC_GET_VOLUME_STATS,
259+
c: csi.NodeServiceCapability_RPC_GET_VOLUME_STATS,
260260
},
261261
{
262-
cap: csi.NodeServiceCapability_RPC_EXPAND_VOLUME,
262+
c: csi.NodeServiceCapability_RPC_EXPAND_VOLUME,
263263
},
264264
}
265265
for _, test := range tests {
266-
resp := NewNodeServiceCapability(test.cap)
266+
resp := NewNodeServiceCapability(test.c)
267267
assert.NotNil(t, resp)
268268
}
269269
}

0 commit comments

Comments
 (0)