Skip to content

Commit 82bb058

Browse files
authored
Merge pull request #1175 from k8s-infra-cherrypick-robot/cherry-pick-1119-to-release-1.23
[release-1.23] test: upgrade golangci/golangci-lint-action to v1.54
2 parents c18c197 + 79c826e commit 82bb058

File tree

17 files changed

+61
-48
lines changed

17 files changed

+61
-48
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: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -577,11 +577,11 @@ func (d *Driver) ValidateVolumeCapabilities(ctx context.Context, req *csi.Valida
577577
}, nil
578578
}
579579

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

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

@@ -591,39 +591,39 @@ func (d *Driver) ControllerGetVolume(context.Context, *csi.ControllerGetVolumeRe
591591
}
592592

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

598598
// ListVolumes return all available volumes
599-
func (d *Driver) ListVolumes(ctx context.Context, req *csi.ListVolumesRequest) (*csi.ListVolumesResponse, error) {
599+
func (d *Driver) ListVolumes(_ context.Context, _ *csi.ListVolumesRequest) (*csi.ListVolumesResponse, error) {
600600
return nil, status.Error(codes.Unimplemented, "ListVolumes is not yet implemented")
601601
}
602602

603603
// CreateSnapshot create snapshot
604-
func (d *Driver) CreateSnapshot(ctx context.Context, req *csi.CreateSnapshotRequest) (*csi.CreateSnapshotResponse, error) {
604+
func (d *Driver) CreateSnapshot(_ context.Context, _ *csi.CreateSnapshotRequest) (*csi.CreateSnapshotResponse, error) {
605605
return nil, status.Error(codes.Unimplemented, "CreateSnapshot is not yet implemented")
606606
}
607607

608608
// DeleteSnapshot delete snapshot
609-
func (d *Driver) DeleteSnapshot(ctx context.Context, req *csi.DeleteSnapshotRequest) (*csi.DeleteSnapshotResponse, error) {
609+
func (d *Driver) DeleteSnapshot(_ context.Context, _ *csi.DeleteSnapshotRequest) (*csi.DeleteSnapshotResponse, error) {
610610
return nil, status.Error(codes.Unimplemented, "DeleteSnapshot is not yet implemented")
611611
}
612612

613613
// ListSnapshots list snapshots
614-
func (d *Driver) ListSnapshots(ctx context.Context, req *csi.ListSnapshotsRequest) (*csi.ListSnapshotsResponse, error) {
614+
func (d *Driver) ListSnapshots(_ context.Context, _ *csi.ListSnapshotsRequest) (*csi.ListSnapshotsResponse, error) {
615615
return nil, status.Error(codes.Unimplemented, "ListSnapshots is not yet implemented")
616616
}
617617

618618
// ControllerGetCapabilities returns the capabilities of the Controller plugin
619-
func (d *Driver) ControllerGetCapabilities(ctx context.Context, req *csi.ControllerGetCapabilitiesRequest) (*csi.ControllerGetCapabilitiesResponse, error) {
619+
func (d *Driver) ControllerGetCapabilities(_ context.Context, _ *csi.ControllerGetCapabilitiesRequest) (*csi.ControllerGetCapabilitiesResponse, error) {
620620
return &csi.ControllerGetCapabilitiesResponse{
621621
Capabilities: d.Cap,
622622
}, nil
623623
}
624624

625625
// ControllerExpandVolume controller expand volume
626-
func (d *Driver) ControllerExpandVolume(ctx context.Context, req *csi.ControllerExpandVolumeRequest) (*csi.ControllerExpandVolumeResponse, error) {
626+
func (d *Driver) ControllerExpandVolume(_ context.Context, req *csi.ControllerExpandVolumeRequest) (*csi.ControllerExpandVolumeResponse, error) {
627627
if len(req.GetVolumeId()) == 0 {
628628
return nil, status.Error(codes.InvalidArgument, "Volume ID missing in request")
629629
}
@@ -711,7 +711,7 @@ func (d *Driver) DeleteBlobContainer(ctx context.Context, subsID, resourceGroupN
711711
}
712712

713713
// CopyBlobContainer copies a blob container in the same storage account
714-
func (d *Driver) copyBlobContainer(ctx context.Context, req *csi.CreateVolumeRequest, accountKey, dstContainerName, storageEndpointSuffix string) error {
714+
func (d *Driver) copyBlobContainer(_ context.Context, req *csi.CreateVolumeRequest, accountKey, dstContainerName, storageEndpointSuffix string) error {
715715
var sourceVolumeID string
716716
if req.GetVolumeContentSource() != nil && req.GetVolumeContentSource().GetVolume() != nil {
717717
sourceVolumeID = req.GetVolumeContentSource().GetVolume().GetVolumeId()

pkg/blob/controllerserver_test.go

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

62-
func (c *mockBlobClient) CreateContainer(ctx context.Context, subsID, resourceGroupName, accountName, containerName string, parameters storage.BlobContainer) *retry.Error {
62+
func (c *mockBlobClient) CreateContainer(_ context.Context, _, _, _, _ string, _ storage.BlobContainer) *retry.Error {
6363
switch *c.errorType {
6464
case DATAPLANE:
6565
return retry.GetError(&http.Response{}, fmt.Errorf(containerBeingDeletedDataplaneAPIError))
@@ -70,7 +70,7 @@ func (c *mockBlobClient) CreateContainer(ctx context.Context, subsID, resourceGr
7070
}
7171
return nil
7272
}
73-
func (c *mockBlobClient) DeleteContainer(ctx context.Context, subsID, resourceGroupName, accountName, containerName string) *retry.Error {
73+
func (c *mockBlobClient) DeleteContainer(_ context.Context, _, _, _, _ string) *retry.Error {
7474
switch *c.errorType {
7575
case DATAPLANE:
7676
return retry.GetError(&http.Response{}, fmt.Errorf(containerBeingDeletedDataplaneAPIError))
@@ -81,7 +81,7 @@ func (c *mockBlobClient) DeleteContainer(ctx context.Context, subsID, resourceGr
8181
}
8282
return nil
8383
}
84-
func (c *mockBlobClient) GetContainer(ctx context.Context, subsID, resourceGroupName, accountName, containerName string) (storage.BlobContainer, *retry.Error) {
84+
func (c *mockBlobClient) GetContainer(_ context.Context, _, _, _, _ string) (storage.BlobContainer, *retry.Error) {
8585
switch *c.errorType {
8686
case DATAPLANE:
8787
return storage.BlobContainer{ContainerProperties: c.conProp}, retry.GetError(&http.Response{}, fmt.Errorf(containerBeingDeletedDataplaneAPIError))
@@ -93,11 +93,11 @@ func (c *mockBlobClient) GetContainer(ctx context.Context, subsID, resourceGroup
9393
return storage.BlobContainer{ContainerProperties: c.conProp}, nil
9494
}
9595

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

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

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

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

112112
cl.EXPECT().
@@ -752,6 +752,7 @@ func TestCreateVolume(t *testing.T) {
752752
}
753753
},
754754
},
755+
//nolint:dupl
755756
{
756757
name: "create volume from copy volumesnapshot is not supported",
757758
testFunc: func(t *testing.T) {
@@ -807,6 +808,7 @@ func TestCreateVolume(t *testing.T) {
807808
}
808809
},
809810
},
811+
//nolint:dupl
810812
{
811813
name: "create volume from copy volume not found",
812814
testFunc: func(t *testing.T) {

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

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