Skip to content

Commit cbacd6e

Browse files
authored
Merge pull request #1179 from umagnus/release-1.22_upgrade
[release-1.22] test: upgrade golangci/golangci-lint-action to v1.54
2 parents 4f5ae07 + fbda489 commit cbacd6e

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
@@ -546,11 +546,11 @@ func (d *Driver) ValidateVolumeCapabilities(ctx context.Context, req *csi.Valida
546546
}, nil
547547
}
548548

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

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

@@ -560,39 +560,39 @@ func (d *Driver) ControllerGetVolume(context.Context, *csi.ControllerGetVolumeRe
560560
}
561561

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

567567
// ListVolumes return all available volumes
568-
func (d *Driver) ListVolumes(ctx context.Context, req *csi.ListVolumesRequest) (*csi.ListVolumesResponse, error) {
568+
func (d *Driver) ListVolumes(_ context.Context, _ *csi.ListVolumesRequest) (*csi.ListVolumesResponse, error) {
569569
return nil, status.Error(codes.Unimplemented, "ListVolumes is not yet implemented")
570570
}
571571

572572
// CreateSnapshot create snapshot
573-
func (d *Driver) CreateSnapshot(ctx context.Context, req *csi.CreateSnapshotRequest) (*csi.CreateSnapshotResponse, error) {
573+
func (d *Driver) CreateSnapshot(_ context.Context, _ *csi.CreateSnapshotRequest) (*csi.CreateSnapshotResponse, error) {
574574
return nil, status.Error(codes.Unimplemented, "CreateSnapshot is not yet implemented")
575575
}
576576

577577
// DeleteSnapshot delete snapshot
578-
func (d *Driver) DeleteSnapshot(ctx context.Context, req *csi.DeleteSnapshotRequest) (*csi.DeleteSnapshotResponse, error) {
578+
func (d *Driver) DeleteSnapshot(_ context.Context, _ *csi.DeleteSnapshotRequest) (*csi.DeleteSnapshotResponse, error) {
579579
return nil, status.Error(codes.Unimplemented, "DeleteSnapshot is not yet implemented")
580580
}
581581

582582
// ListSnapshots list snapshots
583-
func (d *Driver) ListSnapshots(ctx context.Context, req *csi.ListSnapshotsRequest) (*csi.ListSnapshotsResponse, error) {
583+
func (d *Driver) ListSnapshots(_ context.Context, _ *csi.ListSnapshotsRequest) (*csi.ListSnapshotsResponse, error) {
584584
return nil, status.Error(codes.Unimplemented, "ListSnapshots is not yet implemented")
585585
}
586586

587587
// ControllerGetCapabilities returns the capabilities of the Controller plugin
588-
func (d *Driver) ControllerGetCapabilities(ctx context.Context, req *csi.ControllerGetCapabilitiesRequest) (*csi.ControllerGetCapabilitiesResponse, error) {
588+
func (d *Driver) ControllerGetCapabilities(_ context.Context, _ *csi.ControllerGetCapabilitiesRequest) (*csi.ControllerGetCapabilitiesResponse, error) {
589589
return &csi.ControllerGetCapabilitiesResponse{
590590
Capabilities: d.Cap,
591591
}, nil
592592
}
593593

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

pkg/blob/controllerserver_test.go

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

61-
func (c *mockBlobClient) CreateContainer(ctx context.Context, subsID, resourceGroupName, accountName, containerName string, parameters storage.BlobContainer) *retry.Error {
61+
func (c *mockBlobClient) CreateContainer(_ context.Context, _, _, _, _ string, _ storage.BlobContainer) *retry.Error {
6262
switch *c.errorType {
6363
case DATAPLANE:
6464
return retry.GetError(&http.Response{}, fmt.Errorf(containerBeingDeletedDataplaneAPIError))
@@ -69,7 +69,7 @@ func (c *mockBlobClient) CreateContainer(ctx context.Context, subsID, resourceGr
6969
}
7070
return nil
7171
}
72-
func (c *mockBlobClient) DeleteContainer(ctx context.Context, subsID, resourceGroupName, accountName, containerName string) *retry.Error {
72+
func (c *mockBlobClient) DeleteContainer(_ context.Context, _, _, _, _ string) *retry.Error {
7373
switch *c.errorType {
7474
case DATAPLANE:
7575
return retry.GetError(&http.Response{}, fmt.Errorf(containerBeingDeletedDataplaneAPIError))
@@ -80,7 +80,7 @@ func (c *mockBlobClient) DeleteContainer(ctx context.Context, subsID, resourceGr
8080
}
8181
return nil
8282
}
83-
func (c *mockBlobClient) GetContainer(ctx context.Context, subsID, resourceGroupName, accountName, containerName string) (storage.BlobContainer, *retry.Error) {
83+
func (c *mockBlobClient) GetContainer(_ context.Context, _, _, _, _ string) (storage.BlobContainer, *retry.Error) {
8484
switch *c.errorType {
8585
case DATAPLANE:
8686
return storage.BlobContainer{ContainerProperties: c.conProp}, retry.GetError(&http.Response{}, fmt.Errorf(containerBeingDeletedDataplaneAPIError))
@@ -92,11 +92,11 @@ func (c *mockBlobClient) GetContainer(ctx context.Context, subsID, resourceGroup
9292
return storage.BlobContainer{ContainerProperties: c.conProp}, nil
9393
}
9494

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

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

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

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

111111
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
@@ -194,7 +194,7 @@ func (d *Driver) mountBlobfuseInsideDriver(args string, protocol string, authEnv
194194
}
195195

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

428428
// NodeUnstageVolume unmount the volume from the staging path
429-
func (d *Driver) NodeUnstageVolume(ctx context.Context, req *csi.NodeUnstageVolumeRequest) (*csi.NodeUnstageVolumeResponse, error) {
429+
func (d *Driver) NodeUnstageVolume(_ context.Context, req *csi.NodeUnstageVolumeRequest) (*csi.NodeUnstageVolumeResponse, error) {
430430
volumeID := req.GetVolumeId()
431431
if len(volumeID) == 0 {
432432
return nil, status.Error(codes.InvalidArgument, "Volume ID not provided")
@@ -453,26 +453,26 @@ func (d *Driver) NodeUnstageVolume(ctx context.Context, req *csi.NodeUnstageVolu
453453
}
454454

455455
// NodeGetCapabilities return the capabilities of the Node plugin
456-
func (d *Driver) NodeGetCapabilities(ctx context.Context, req *csi.NodeGetCapabilitiesRequest) (*csi.NodeGetCapabilitiesResponse, error) {
456+
func (d *Driver) NodeGetCapabilities(_ context.Context, _ *csi.NodeGetCapabilitiesRequest) (*csi.NodeGetCapabilitiesResponse, error) {
457457
return &csi.NodeGetCapabilitiesResponse{
458458
Capabilities: d.NSCap,
459459
}, nil
460460
}
461461

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

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

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

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
@@ -118,7 +118,7 @@ func exportMetrics() {
118118
serve(context.Background(), l, serveMetrics)
119119
}
120120

121-
func serve(ctx context.Context, l net.Listener, serveFunc func(net.Listener) error) {
121+
func serve(_ context.Context, l net.Listener, serveFunc func(net.Listener) error) {
122122
path := l.Addr().String()
123123
klog.V(2).Infof("set up prometheus server on %v", path)
124124
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)