Skip to content

Commit b5c72b3

Browse files
authored
Merge pull request #1185 from umagnus/release-1.21
[release-1.21] test: upgrade golangci/golangci-lint-action to v1.54
2 parents 1f0c33a + 7b51b66 commit b5c72b3

File tree

16 files changed

+53
-41
lines changed

16 files changed

+53
-41
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.51
19-
args: -E=gofmt,deadcode,unused,varcheck,ineffassign,revive,misspell,exportloopref,asciicheck,bodyclose,depguard,dogsled,durationcheck,errname,forbidigo -D=staticcheck --timeout=30m0s
18+
version: v1.54
19+
args: -E=gofmt,unused,ineffassign,revive,misspell,exportloopref,asciicheck,bodyclose,depguard,dogsled,durationcheck,errname,forbidigo -D=staticcheck --timeout=30m0s

.golangci.yml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
linters-settings:
2+
depguard:
3+
rules:
4+
main:
5+
files:
6+
- $all
7+
- "!$test"
8+
allow:
9+
- $gostd
10+
- k8s.io
11+
- sigs.k8s.io
12+
- github.com

pkg/blob/controllerserver.go

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -540,11 +540,11 @@ func (d *Driver) ValidateVolumeCapabilities(ctx context.Context, req *csi.Valida
540540
}, nil
541541
}
542542

543-
func (d *Driver) ControllerPublishVolume(ctx context.Context, req *csi.ControllerPublishVolumeRequest) (*csi.ControllerPublishVolumeResponse, error) {
543+
func (d *Driver) ControllerPublishVolume(_ context.Context, _ *csi.ControllerPublishVolumeRequest) (*csi.ControllerPublishVolumeResponse, error) {
544544
return nil, status.Error(codes.Unimplemented, "ControllerPublishVolume is not yet implemented")
545545
}
546546

547-
func (d *Driver) ControllerUnpublishVolume(ctx context.Context, req *csi.ControllerUnpublishVolumeRequest) (*csi.ControllerUnpublishVolumeResponse, error) {
547+
func (d *Driver) ControllerUnpublishVolume(_ context.Context, _ *csi.ControllerUnpublishVolumeRequest) (*csi.ControllerUnpublishVolumeResponse, error) {
548548
return nil, status.Error(codes.Unimplemented, "ControllerUnpublishVolume is not yet implemented")
549549
}
550550

@@ -554,39 +554,39 @@ func (d *Driver) ControllerGetVolume(context.Context, *csi.ControllerGetVolumeRe
554554
}
555555

556556
// GetCapacity returns the capacity of the total available storage pool
557-
func (d *Driver) GetCapacity(ctx context.Context, req *csi.GetCapacityRequest) (*csi.GetCapacityResponse, error) {
557+
func (d *Driver) GetCapacity(_ context.Context, _ *csi.GetCapacityRequest) (*csi.GetCapacityResponse, error) {
558558
return nil, status.Error(codes.Unimplemented, "GetCapacity is not yet implemented")
559559
}
560560

561561
// ListVolumes return all available volumes
562-
func (d *Driver) ListVolumes(ctx context.Context, req *csi.ListVolumesRequest) (*csi.ListVolumesResponse, error) {
562+
func (d *Driver) ListVolumes(_ context.Context, _ *csi.ListVolumesRequest) (*csi.ListVolumesResponse, error) {
563563
return nil, status.Error(codes.Unimplemented, "ListVolumes is not yet implemented")
564564
}
565565

566566
// CreateSnapshot create snapshot
567-
func (d *Driver) CreateSnapshot(ctx context.Context, req *csi.CreateSnapshotRequest) (*csi.CreateSnapshotResponse, error) {
567+
func (d *Driver) CreateSnapshot(_ context.Context, _ *csi.CreateSnapshotRequest) (*csi.CreateSnapshotResponse, error) {
568568
return nil, status.Error(codes.Unimplemented, "CreateSnapshot is not yet implemented")
569569
}
570570

571571
// DeleteSnapshot delete snapshot
572-
func (d *Driver) DeleteSnapshot(ctx context.Context, req *csi.DeleteSnapshotRequest) (*csi.DeleteSnapshotResponse, error) {
572+
func (d *Driver) DeleteSnapshot(_ context.Context, _ *csi.DeleteSnapshotRequest) (*csi.DeleteSnapshotResponse, error) {
573573
return nil, status.Error(codes.Unimplemented, "DeleteSnapshot is not yet implemented")
574574
}
575575

576576
// ListSnapshots list snapshots
577-
func (d *Driver) ListSnapshots(ctx context.Context, req *csi.ListSnapshotsRequest) (*csi.ListSnapshotsResponse, error) {
577+
func (d *Driver) ListSnapshots(_ context.Context, _ *csi.ListSnapshotsRequest) (*csi.ListSnapshotsResponse, error) {
578578
return nil, status.Error(codes.Unimplemented, "ListSnapshots is not yet implemented")
579579
}
580580

581581
// ControllerGetCapabilities returns the capabilities of the Controller plugin
582-
func (d *Driver) ControllerGetCapabilities(ctx context.Context, req *csi.ControllerGetCapabilitiesRequest) (*csi.ControllerGetCapabilitiesResponse, error) {
582+
func (d *Driver) ControllerGetCapabilities(_ context.Context, _ *csi.ControllerGetCapabilitiesRequest) (*csi.ControllerGetCapabilitiesResponse, error) {
583583
return &csi.ControllerGetCapabilitiesResponse{
584584
Capabilities: d.Cap,
585585
}, nil
586586
}
587587

588588
// ControllerExpandVolume controller expand volume
589-
func (d *Driver) ControllerExpandVolume(ctx context.Context, req *csi.ControllerExpandVolumeRequest) (*csi.ControllerExpandVolumeResponse, error) {
589+
func (d *Driver) ControllerExpandVolume(_ context.Context, req *csi.ControllerExpandVolumeRequest) (*csi.ControllerExpandVolumeResponse, error) {
590590
if len(req.GetVolumeId()) == 0 {
591591
return nil, status.Error(codes.InvalidArgument, "Volume ID missing in request")
592592
}

pkg/blob/controllerserver_test.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ type mockBlobClient struct {
5757
conProp *storage.ContainerProperties
5858
}
5959

60-
func (c *mockBlobClient) CreateContainer(ctx context.Context, subsID, resourceGroupName, accountName, containerName string, parameters storage.BlobContainer) *retry.Error {
60+
func (c *mockBlobClient) CreateContainer(_ context.Context, _, _, _, _ string, _ storage.BlobContainer) *retry.Error {
6161
switch *c.errorType {
6262
case DATAPLANE:
6363
return retry.GetError(&http.Response{}, fmt.Errorf(containerBeingDeletedDataplaneAPIError))
@@ -68,7 +68,7 @@ func (c *mockBlobClient) CreateContainer(ctx context.Context, subsID, resourceGr
6868
}
6969
return nil
7070
}
71-
func (c *mockBlobClient) DeleteContainer(ctx context.Context, subsID, resourceGroupName, accountName, containerName string) *retry.Error {
71+
func (c *mockBlobClient) DeleteContainer(_ context.Context, _, _, _, _ string) *retry.Error {
7272
switch *c.errorType {
7373
case DATAPLANE:
7474
return retry.GetError(&http.Response{}, fmt.Errorf(containerBeingDeletedDataplaneAPIError))
@@ -79,7 +79,7 @@ func (c *mockBlobClient) DeleteContainer(ctx context.Context, subsID, resourceGr
7979
}
8080
return nil
8181
}
82-
func (c *mockBlobClient) GetContainer(ctx context.Context, subsID, resourceGroupName, accountName, containerName string) (storage.BlobContainer, *retry.Error) {
82+
func (c *mockBlobClient) GetContainer(_ context.Context, _, _, _, _ string) (storage.BlobContainer, *retry.Error) {
8383
switch *c.errorType {
8484
case DATAPLANE:
8585
return storage.BlobContainer{ContainerProperties: c.conProp}, retry.GetError(&http.Response{}, fmt.Errorf(containerBeingDeletedDataplaneAPIError))
@@ -91,11 +91,11 @@ func (c *mockBlobClient) GetContainer(ctx context.Context, subsID, resourceGroup
9191
return storage.BlobContainer{ContainerProperties: c.conProp}, nil
9292
}
9393

94-
func (c *mockBlobClient) GetServiceProperties(ctx context.Context, subsID, resourceGroupName, accountName string) (storage.BlobServiceProperties, error) {
94+
func (c *mockBlobClient) GetServiceProperties(_ context.Context, _, _, _ string) (storage.BlobServiceProperties, error) {
9595
return storage.BlobServiceProperties{}, nil
9696
}
9797

98-
func (c *mockBlobClient) SetServiceProperties(ctx context.Context, subsID, resourceGroupName, accountName string, parameters storage.BlobServiceProperties) (storage.BlobServiceProperties, error) {
98+
func (c *mockBlobClient) SetServiceProperties(_ context.Context, _, _, _ string, _ storage.BlobServiceProperties) (storage.BlobServiceProperties, error) {
9999
return storage.BlobServiceProperties{}, nil
100100
}
101101

@@ -104,7 +104,7 @@ func newMockBlobClient(errorType *errType, custom *string, conProp *storage.Cont
104104
}
105105

106106
// creates and returns mock storage account client
107-
func NewMockSAClient(ctx context.Context, ctrl *gomock.Controller, subsID, rg, accName string, keyList *[]storage.AccountKey) *mockstorageaccountclient.MockInterface {
107+
func NewMockSAClient(_ context.Context, ctrl *gomock.Controller, _, _, _ string, keyList *[]storage.AccountKey) *mockstorageaccountclient.MockInterface {
108108
cl := mockstorageaccountclient.NewMockInterface(ctrl)
109109

110110
cl.EXPECT().

pkg/blob/fake_mount.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ type fakeMounter struct {
2828
}
2929

3030
// Mount overrides mount.FakeMounter.Mount.
31-
func (f *fakeMounter) Mount(source string, target string, fstype string, options []string) error {
31+
func (f *fakeMounter) Mount(source string, target string, _ string, _ []string) error {
3232
if strings.Contains(source, "error_mount") {
3333
return fmt.Errorf("fake Mount: source error")
3434
} else if strings.Contains(target, "error_mount") {
@@ -39,7 +39,7 @@ func (f *fakeMounter) Mount(source string, target string, fstype string, options
3939
}
4040

4141
// MountSensitive overrides mount.FakeMounter.MountSensitive.
42-
func (f *fakeMounter) MountSensitive(source string, target string, fstype string, options []string, sensitiveOptions []string) error {
42+
func (f *fakeMounter) MountSensitive(source string, target string, _ string, _ []string, _ []string) error {
4343
if strings.Contains(source, "ut-container") {
4444
return fmt.Errorf("fake MountSensitive: source error")
4545
} else if strings.Contains(target, "error_mount_sens") {

pkg/blob/identityserver.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ import (
2727
)
2828

2929
// GetPluginInfo return the version and name of the plugin
30-
func (f *Driver) GetPluginInfo(ctx context.Context, req *csi.GetPluginInfoRequest) (*csi.GetPluginInfoResponse, error) {
30+
func (f *Driver) GetPluginInfo(_ context.Context, _ *csi.GetPluginInfoRequest) (*csi.GetPluginInfoResponse, error) {
3131
if f.Name == "" {
3232
return nil, status.Error(codes.Unavailable, "Driver name not configured")
3333
}
@@ -46,12 +46,12 @@ func (f *Driver) GetPluginInfo(ctx context.Context, req *csi.GetPluginInfoReques
4646
// This method does not need to return anything.
4747
// Currently the spec does not dictate what you should return either.
4848
// Hence, return an empty response
49-
func (f *Driver) Probe(ctx context.Context, req *csi.ProbeRequest) (*csi.ProbeResponse, error) {
49+
func (f *Driver) Probe(_ context.Context, _ *csi.ProbeRequest) (*csi.ProbeResponse, error) {
5050
return &csi.ProbeResponse{Ready: &wrappers.BoolValue{Value: true}}, nil
5151
}
5252

5353
// GetPluginCapabilities returns the capabilities of the plugin
54-
func (f *Driver) GetPluginCapabilities(ctx context.Context, req *csi.GetPluginCapabilitiesRequest) (*csi.GetPluginCapabilitiesResponse, error) {
54+
func (f *Driver) GetPluginCapabilities(_ context.Context, _ *csi.GetPluginCapabilitiesRequest) (*csi.GetPluginCapabilitiesResponse, error) {
5555
return &csi.GetPluginCapabilitiesResponse{
5656
Capabilities: []*csi.PluginCapability{
5757
{

pkg/blob/nodeserver.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,7 @@ func (d *Driver) mountBlobfuseInsideDriver(args string, protocol string, authEnv
195195
}
196196

197197
// NodeUnpublishVolume unmount the volume from the target path
198-
func (d *Driver) NodeUnpublishVolume(ctx context.Context, req *csi.NodeUnpublishVolumeRequest) (*csi.NodeUnpublishVolumeResponse, error) {
198+
func (d *Driver) NodeUnpublishVolume(_ context.Context, req *csi.NodeUnpublishVolumeRequest) (*csi.NodeUnpublishVolumeResponse, error) {
199199
volumeID := req.GetVolumeId()
200200
if len(volumeID) == 0 {
201201
return nil, status.Error(codes.InvalidArgument, "Volume ID missing in request")
@@ -422,7 +422,7 @@ func (d *Driver) NodeStageVolume(ctx context.Context, req *csi.NodeStageVolumeRe
422422
}
423423

424424
// NodeUnstageVolume unmount the volume from the staging path
425-
func (d *Driver) NodeUnstageVolume(ctx context.Context, req *csi.NodeUnstageVolumeRequest) (*csi.NodeUnstageVolumeResponse, error) {
425+
func (d *Driver) NodeUnstageVolume(_ context.Context, req *csi.NodeUnstageVolumeRequest) (*csi.NodeUnstageVolumeResponse, error) {
426426
volumeID := req.GetVolumeId()
427427
if len(volumeID) == 0 {
428428
return nil, status.Error(codes.InvalidArgument, "Volume ID not provided")
@@ -449,26 +449,26 @@ func (d *Driver) NodeUnstageVolume(ctx context.Context, req *csi.NodeUnstageVolu
449449
}
450450

451451
// NodeGetCapabilities return the capabilities of the Node plugin
452-
func (d *Driver) NodeGetCapabilities(ctx context.Context, req *csi.NodeGetCapabilitiesRequest) (*csi.NodeGetCapabilitiesResponse, error) {
452+
func (d *Driver) NodeGetCapabilities(_ context.Context, _ *csi.NodeGetCapabilitiesRequest) (*csi.NodeGetCapabilitiesResponse, error) {
453453
return &csi.NodeGetCapabilitiesResponse{
454454
Capabilities: d.NSCap,
455455
}, nil
456456
}
457457

458458
// NodeGetInfo return info of the node on which this plugin is running
459-
func (d *Driver) NodeGetInfo(ctx context.Context, req *csi.NodeGetInfoRequest) (*csi.NodeGetInfoResponse, error) {
459+
func (d *Driver) NodeGetInfo(_ context.Context, _ *csi.NodeGetInfoRequest) (*csi.NodeGetInfoResponse, error) {
460460
return &csi.NodeGetInfoResponse{
461461
NodeId: d.NodeID,
462462
}, nil
463463
}
464464

465465
// NodeExpandVolume node expand volume
466-
func (d *Driver) NodeExpandVolume(ctx context.Context, req *csi.NodeExpandVolumeRequest) (*csi.NodeExpandVolumeResponse, error) {
466+
func (d *Driver) NodeExpandVolume(_ context.Context, _ *csi.NodeExpandVolumeRequest) (*csi.NodeExpandVolumeResponse, error) {
467467
return nil, status.Error(codes.Unimplemented, "NodeExpandVolume is not yet implemented")
468468
}
469469

470470
// NodeGetVolumeStats get volume stats
471-
func (d *Driver) NodeGetVolumeStats(ctx context.Context, req *csi.NodeGetVolumeStatsRequest) (*csi.NodeGetVolumeStatsResponse, error) {
471+
func (d *Driver) NodeGetVolumeStats(_ context.Context, req *csi.NodeGetVolumeStatsRequest) (*csi.NodeGetVolumeStatsResponse, error) {
472472
if len(req.VolumeId) == 0 {
473473
return nil, status.Error(codes.InvalidArgument, "NodeGetVolumeStats volume ID was empty")
474474
}

pkg/blobfuse-proxy/server/server.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ func NewMountServiceServer() *MountServer {
5555
}
5656

5757
// MountAzureBlob mounts an azure blob container to given location
58-
func (server *MountServer) MountAzureBlob(ctx context.Context,
58+
func (server *MountServer) MountAzureBlob(_ context.Context,
5959
req *mount_azure_blob.MountAzureBlobRequest,
6060
) (resp *mount_azure_blob.MountAzureBlobResponse, err error) {
6161
mutex.Lock()

pkg/blobplugin/main.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ func exportMetrics() {
114114
serve(context.Background(), l, serveMetrics)
115115
}
116116

117-
func serve(ctx context.Context, l net.Listener, serveFunc func(net.Listener) error) {
117+
func serve(_ context.Context, l net.Listener, serveFunc func(net.Listener) error) {
118118
path := l.Addr().String()
119119
klog.V(2).Infof("set up prometheus server on %v", path)
120120
go func() {

pkg/csi-common/driver_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ func TestNewFakeDriver(t *testing.T) {
6363
assert.Nil(t, d)
6464
}
6565

66-
func TestAddControllerServiceCapabilities(t *testing.T) {
66+
func TestAddControllerServiceCapabilities(_ *testing.T) {
6767
d := NewFakeDriver()
6868
var cl []csi.ControllerServiceCapability_RPC_Type
6969
cl = append(cl, csi.ControllerServiceCapability_RPC_UNKNOWN)

0 commit comments

Comments
 (0)