Skip to content

Commit 1a22f5b

Browse files
committed
test: upgrade golint action version
test: fix golint depguard error fix golint golint fix
1 parent b8965f2 commit 1a22f5b

File tree

4 files changed

+15
-52
lines changed

4 files changed

+15
-52
lines changed

.github/workflows/static.yaml

+2-2
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,exportloopref,asciicheck,bodyclose,depguard,dogsled,durationcheck,errname,forbidigo -D=structcheck,typecheck,staticcheck --timeout=30m0s
18+
version: v1.64
19+
args: -E=gofmt,unused,ineffassign,revive,misspell,asciicheck,bodyclose,dogsled,durationcheck,errname,forbidigo -D=structcheck,typecheck,staticcheck --timeout=30m0s

pkg/azuredisk/azure_common_windows.go

+7-44
Original file line numberDiff line numberDiff line change
@@ -95,61 +95,24 @@ func CleanupMountPoint(path string, m *mount.SafeFormatAndMount, unmountVolume b
9595
}
9696

9797
func getDevicePathWithMountPath(mountPath string, m *mount.SafeFormatAndMount) (string, error) {
98-
var devicePath string
99-
var err error
100-
10198
if proxy, ok := m.Interface.(mounter.CSIProxyMounter); ok {
102-
devicePath, err = proxy.GetDeviceNameFromMount(mountPath, "")
103-
} else {
104-
return "", fmt.Errorf("could not cast to csi proxy class")
105-
}
106-
107-
if err != nil {
108-
if sts, ok := status.FromError(err); ok {
109-
return "", fmt.Errorf(sts.Message())
110-
}
111-
return "", err
99+
return proxy.GetDeviceNameFromMount(mountPath, "")
112100
}
113-
114-
return devicePath, nil
101+
return "", fmt.Errorf("could not cast to csi proxy class")
115102
}
116103

117104
func getBlockSizeBytes(devicePath string, m *mount.SafeFormatAndMount) (int64, error) {
118-
var sizeInBytes int64
119-
var err error
120-
121105
if proxy, ok := m.Interface.(mounter.CSIProxyMounter); ok {
122-
sizeInBytes, err = proxy.GetVolumeSizeInBytes(devicePath)
123-
} else {
124-
return -1, fmt.Errorf("could not cast to csi proxy class")
125-
}
126-
127-
if err != nil {
128-
if sts, ok := status.FromError(err); ok {
129-
return -1, fmt.Errorf(sts.Message())
130-
}
131-
return -1, err
106+
return proxy.GetVolumeSizeInBytes(devicePath)
132107
}
133-
134-
return sizeInBytes, nil
108+
return -1, fmt.Errorf("could not cast to csi proxy class")
135109
}
136110

137111
func resizeVolume(devicePath, volumePath string, m *mount.SafeFormatAndMount) error {
138-
var err error
139112
if proxy, ok := m.Interface.(mounter.CSIProxyMounter); ok {
140-
err = proxy.ResizeVolume(devicePath)
141-
} else {
142-
return fmt.Errorf("could not cast to csi proxy class")
113+
return proxy.ResizeVolume(devicePath)
143114
}
144-
145-
if err != nil {
146-
if sts, ok := status.FromError(err); ok {
147-
return fmt.Errorf(sts.Message())
148-
}
149-
return err
150-
}
151-
152-
return nil
115+
return fmt.Errorf("could not cast to csi proxy class")
153116
}
154117

155118
// needResizeVolume check whether device needs resize
@@ -171,7 +134,7 @@ func (d *DriverCore) GetVolumeStats(ctx context.Context, m *mount.SafeFormatAndM
171134
// check if the volume stats is cached
172135
cache, err := d.volStatsCache.Get(ctx, volumeID, azcache.CacheReadTypeDefault)
173136
if err != nil {
174-
return nil, status.Errorf(codes.Internal, err.Error())
137+
return nil, status.Errorf(codes.Internal, "%v", err)
175138
}
176139
if cache != nil {
177140
volUsage := cache.(csi.VolumeUsage)

pkg/azureutils/azure_disk_utils.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -441,9 +441,9 @@ func IsValidVolumeCapabilities(volCaps []*csi.VolumeCapability, maxShares int) e
441441
}
442442

443443
func IsValidAccessModes(volCaps []*csi.VolumeCapability) bool {
444-
hasSupport := func(cap *csi.VolumeCapability) bool {
444+
hasSupport := func(capability *csi.VolumeCapability) bool {
445445
for _, c := range volumeCaps {
446-
if c.GetMode() == cap.AccessMode.GetMode() {
446+
if c.GetMode() == capability.AccessMode.GetMode() {
447447
return true
448448
}
449449
}

pkg/csi-common/utils.go

+4-4
Original file line numberDiff line numberDiff line change
@@ -70,21 +70,21 @@ func NewVolumeCapabilityAccessMode(mode csi.VolumeCapability_AccessMode_Mode) *c
7070
return &csi.VolumeCapability_AccessMode{Mode: mode}
7171
}
7272

73-
func NewControllerServiceCapability(cap csi.ControllerServiceCapability_RPC_Type) *csi.ControllerServiceCapability {
73+
func NewControllerServiceCapability(c csi.ControllerServiceCapability_RPC_Type) *csi.ControllerServiceCapability {
7474
return &csi.ControllerServiceCapability{
7575
Type: &csi.ControllerServiceCapability_Rpc{
7676
Rpc: &csi.ControllerServiceCapability_RPC{
77-
Type: cap,
77+
Type: c,
7878
},
7979
},
8080
}
8181
}
8282

83-
func NewNodeServiceCapability(cap csi.NodeServiceCapability_RPC_Type) *csi.NodeServiceCapability {
83+
func NewNodeServiceCapability(c csi.NodeServiceCapability_RPC_Type) *csi.NodeServiceCapability {
8484
return &csi.NodeServiceCapability{
8585
Type: &csi.NodeServiceCapability_Rpc{
8686
Rpc: &csi.NodeServiceCapability_RPC{
87-
Type: cap,
87+
Type: c,
8888
},
8989
},
9090
}

0 commit comments

Comments
 (0)