Skip to content

Commit c1b7ebc

Browse files
xinydevaskervin
authored andcommitted
scripts/ci: upgrade golangci-lint
- Upgrade golangci-lint to version 1.52.2 to address OOM issues (golangci/golangci-lint#3538) - Fix issues detected by the new version of golangci-lint Signed-off-by: Xin Yang <[email protected]> Change-Id: I489d7d7b7b3c7b44e4566bee16a3ed5a2a990aef Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk-csi/+/17968 Reviewed-by: Yibo Cai <[email protected]> Tested-by: SPDK CI Jenkins <[email protected]> Reviewed-by: Antti Kervinen <[email protected]> Reviewed-by: Jing Yan <[email protected]>
1 parent 929a2a3 commit c1b7ebc

9 files changed

+18
-16
lines changed

Makefile

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ OUT_DIR := ./_out
1717
# dir for tools: e.g., golangci-lint
1818
TOOL_DIR := $(OUT_DIR)/tool
1919
# use golangci-lint for static code check
20-
GOLANGCI_VERSION := v1.49.0
20+
GOLANGCI_VERSION := v1.52.2
2121
GOLANGCI_BIN := $(TOOL_DIR)/golangci-lint
2222
# go source, scripts
2323
SOURCE_DIRS := cmd pkg

e2e/utils.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -281,7 +281,7 @@ func execCommandInPod(f *framework.Framework, c, ns string, opt *metav1.ListOpti
281281
if stdErr != "" {
282282
e2elog.Logf("stdErr occurred: %v", stdErr)
283283
}
284-
Expect(err).Should(BeNil())
284+
Expect(err).ShouldNot(HaveOccurred())
285285
return stdOut, stdErr
286286
}
287287

@@ -290,7 +290,7 @@ func getCommandInPodOpts(f *framework.Framework, c, ns string, opt *metav1.ListO
290290
podList, err := f.PodClientNS(ns).List(ctx, *opt)
291291
framework.ExpectNoError(err)
292292
Expect(podList.Items).NotTo(BeNil())
293-
Expect(err).Should(BeNil())
293+
Expect(err).ShouldNot(HaveOccurred())
294294

295295
return framework.ExecOptions{
296296
Command: cmd,

pkg/csi-common/controllerserver-default.go

+1
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ See the License for the specific language governing permissions and
1414
limitations under the License.
1515
*/
1616

17+
//nolint:revive // csi spec
1718
package csicommon
1819

1920
import (

pkg/csi-common/identityserver-default.go

+1
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ See the License for the specific language governing permissions and
1414
limitations under the License.
1515
*/
1616

17+
//nolint:revive // csi spec
1718
package csicommon
1819

1920
import (

pkg/csi-common/nodeserver-default.go

+1
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ See the License for the specific language governing permissions and
1414
limitations under the License.
1515
*/
1616

17+
//nolint:revive // csi spec
1718
package csicommon
1819

1920
import (

pkg/spdk/controllerserver.go

+6-6
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ type volume struct {
5353
mtx sync.Mutex // per volume lock to serialize DeleteVolume requests
5454
}
5555

56-
func (cs *controllerServer) CreateVolume(ctx context.Context, req *csi.CreateVolumeRequest) (*csi.CreateVolumeResponse, error) {
56+
func (cs *controllerServer) CreateVolume(_ context.Context, req *csi.CreateVolumeRequest) (*csi.CreateVolumeResponse, error) {
5757
// be idempotent to duplicated requests
5858
volume, err := func() (*volume, error) {
5959
const creatingTag = "__CREATING__"
@@ -120,7 +120,7 @@ func (cs *controllerServer) CreateVolume(ctx context.Context, req *csi.CreateVol
120120
return &csi.CreateVolumeResponse{Volume: &volume.csiVolume}, nil
121121
}
122122

123-
func (cs *controllerServer) DeleteVolume(ctx context.Context, req *csi.DeleteVolumeRequest) (*csi.DeleteVolumeResponse, error) {
123+
func (cs *controllerServer) DeleteVolume(_ context.Context, req *csi.DeleteVolumeRequest) (*csi.DeleteVolumeResponse, error) {
124124
volumeID := req.GetVolumeId()
125125
cs.mtx.Lock()
126126
volume, exists := cs.volumes[volumeID]
@@ -168,7 +168,7 @@ func (cs *controllerServer) DeleteVolume(ctx context.Context, req *csi.DeleteVol
168168
return &csi.DeleteVolumeResponse{}, nil
169169
}
170170

171-
func (cs *controllerServer) ValidateVolumeCapabilities(ctx context.Context, req *csi.ValidateVolumeCapabilitiesRequest) (*csi.ValidateVolumeCapabilitiesResponse, error) {
171+
func (cs *controllerServer) ValidateVolumeCapabilities(_ context.Context, req *csi.ValidateVolumeCapabilitiesRequest) (*csi.ValidateVolumeCapabilitiesResponse, error) {
172172
// make sure we support all requested caps
173173
for _, cap := range req.VolumeCapabilities {
174174
supported := false
@@ -189,7 +189,7 @@ func (cs *controllerServer) ValidateVolumeCapabilities(ctx context.Context, req
189189
}, nil
190190
}
191191

192-
func (cs *controllerServer) ControllerGetVolume(ctx context.Context, req *csi.ControllerGetVolumeRequest) (*csi.ControllerGetVolumeResponse, error) {
192+
func (cs *controllerServer) ControllerGetVolume(_ context.Context, req *csi.ControllerGetVolumeRequest) (*csi.ControllerGetVolumeResponse, error) {
193193
volumeID := req.GetVolumeId()
194194

195195
cs.mtx.Lock()
@@ -204,7 +204,7 @@ func (cs *controllerServer) ControllerGetVolume(ctx context.Context, req *csi.Co
204204
return &csi.ControllerGetVolumeResponse{Volume: &volume.csiVolume}, nil
205205
}
206206

207-
func (cs *controllerServer) CreateSnapshot(ctx context.Context, req *csi.CreateSnapshotRequest) (*csi.CreateSnapshotResponse, error) {
207+
func (cs *controllerServer) CreateSnapshot(_ context.Context, req *csi.CreateSnapshotRequest) (*csi.CreateSnapshotResponse, error) {
208208
lvolID := req.GetSourceVolumeId()
209209
snapshotName := req.GetName()
210210

@@ -251,7 +251,7 @@ func (cs *controllerServer) CreateSnapshot(ctx context.Context, req *csi.CreateS
251251
}, nil
252252
}
253253

254-
func (cs *controllerServer) DeleteSnapshot(ctx context.Context, req *csi.DeleteSnapshotRequest) (*csi.DeleteSnapshotResponse, error) {
254+
func (cs *controllerServer) DeleteSnapshot(_ context.Context, req *csi.DeleteSnapshotRequest) (*csi.DeleteSnapshotResponse, error) {
255255
snapshotID := req.SnapshotId
256256
cs.mtxSnapshot.RLock()
257257
exSnap, exists := cs.snapshotsIdem[snapshotID]

pkg/spdk/identityserver.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ func newIdentityServer(d *csicommon.CSIDriver) *identityServer {
3434
}
3535
}
3636

37-
func (ids *identityServer) GetPluginCapabilities(ctx context.Context, req *csi.GetPluginCapabilitiesRequest) (*csi.GetPluginCapabilitiesResponse, error) {
37+
func (ids *identityServer) GetPluginCapabilities(_ context.Context, _ *csi.GetPluginCapabilitiesRequest) (*csi.GetPluginCapabilitiesResponse, error) {
3838
return &csi.GetPluginCapabilitiesResponse{
3939
Capabilities: []*csi.PluginCapability{
4040
{

pkg/spdk/nodeserver.go

+5-5
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ func newNodeServer(d *csicommon.CSIDriver) (*nodeServer, error) {
129129
return ns, nil
130130
}
131131

132-
func (ns *nodeServer) NodeStageVolume(ctx context.Context, req *csi.NodeStageVolumeRequest) (*csi.NodeStageVolumeResponse, error) {
132+
func (ns *nodeServer) NodeStageVolume(_ context.Context, req *csi.NodeStageVolumeRequest) (*csi.NodeStageVolumeResponse, error) {
133133
volume, err := func() (*nodeVolume, error) {
134134
volumeID := req.GetVolumeId()
135135
ns.mtx.Lock()
@@ -181,7 +181,7 @@ func (ns *nodeServer) NodeStageVolume(ctx context.Context, req *csi.NodeStageVol
181181
return nil, status.Error(codes.Aborted, "concurrent request ongoing")
182182
}
183183

184-
func (ns *nodeServer) NodeUnstageVolume(ctx context.Context, req *csi.NodeUnstageVolumeRequest) (*csi.NodeUnstageVolumeResponse, error) {
184+
func (ns *nodeServer) NodeUnstageVolume(_ context.Context, req *csi.NodeUnstageVolumeRequest) (*csi.NodeUnstageVolumeResponse, error) {
185185
volumeID := req.GetVolumeId()
186186
ns.mtx.Lock()
187187
volume, exists := ns.volumes[volumeID]
@@ -221,7 +221,7 @@ func (ns *nodeServer) NodeUnstageVolume(ctx context.Context, req *csi.NodeUnstag
221221
return &csi.NodeUnstageVolumeResponse{}, nil
222222
}
223223

224-
func (ns *nodeServer) NodePublishVolume(ctx context.Context, req *csi.NodePublishVolumeRequest) (*csi.NodePublishVolumeResponse, error) {
224+
func (ns *nodeServer) NodePublishVolume(_ context.Context, req *csi.NodePublishVolumeRequest) (*csi.NodePublishVolumeResponse, error) {
225225
volumeID := req.GetVolumeId()
226226
ns.mtx.Lock()
227227
volume, exists := ns.volumes[volumeID]
@@ -245,7 +245,7 @@ func (ns *nodeServer) NodePublishVolume(ctx context.Context, req *csi.NodePublis
245245
return nil, status.Error(codes.Aborted, "concurrent request ongoing")
246246
}
247247

248-
func (ns *nodeServer) NodeUnpublishVolume(ctx context.Context, req *csi.NodeUnpublishVolumeRequest) (*csi.NodeUnpublishVolumeResponse, error) {
248+
func (ns *nodeServer) NodeUnpublishVolume(_ context.Context, req *csi.NodeUnpublishVolumeRequest) (*csi.NodeUnpublishVolumeResponse, error) {
249249
volumeID := req.GetVolumeId()
250250
ns.mtx.Lock()
251251
volume, exists := ns.volumes[volumeID]
@@ -266,7 +266,7 @@ func (ns *nodeServer) NodeUnpublishVolume(ctx context.Context, req *csi.NodeUnpu
266266
return nil, status.Error(codes.Aborted, "concurrent request ongoing")
267267
}
268268

269-
func (ns *nodeServer) NodeGetCapabilities(ctx context.Context, req *csi.NodeGetCapabilitiesRequest) (*csi.NodeGetCapabilitiesResponse, error) {
269+
func (ns *nodeServer) NodeGetCapabilities(_ context.Context, _ *csi.NodeGetCapabilitiesRequest) (*csi.NodeGetCapabilitiesResponse, error) {
270270
return &csi.NodeGetCapabilitiesResponse{
271271
Capabilities: []*csi.NodeServiceCapability{
272272
{

pkg/util/jsonrpc.go

-1
Original file line numberDiff line numberDiff line change
@@ -266,7 +266,6 @@ func (client *rpcClient) call(method string, args, result interface{}) error {
266266
}
267267

268268
defer resp.Body.Close()
269-
//nolint:usestdlibvars // >= 400 rather than >= http.StatusBadRequest
270269
if resp.StatusCode >= 400 {
271270
return fmt.Errorf("%s: HTTP error code: %d", method, resp.StatusCode)
272271
}

0 commit comments

Comments
 (0)