Skip to content

Commit

Permalink
scripts/ci: upgrade golangci-lint
Browse files Browse the repository at this point in the history
- 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 <Xin.Yang@arm.com>
Change-Id: I489d7d7b7b3c7b44e4566bee16a3ed5a2a990aef
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk-csi/+/17968
Reviewed-by: Yibo Cai <yibo.cai@arm.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Antti Kervinen <antti.kervinen@intel.com>
Reviewed-by: Jing Yan <jing1.yan@intel.com>
  • Loading branch information
xinydev authored and askervin committed May 8, 2023
1 parent 929a2a3 commit c1b7ebc
Show file tree
Hide file tree
Showing 9 changed files with 18 additions and 16 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ OUT_DIR := ./_out
# dir for tools: e.g., golangci-lint
TOOL_DIR := $(OUT_DIR)/tool
# use golangci-lint for static code check
GOLANGCI_VERSION := v1.49.0
GOLANGCI_VERSION := v1.52.2
GOLANGCI_BIN := $(TOOL_DIR)/golangci-lint
# go source, scripts
SOURCE_DIRS := cmd pkg
Expand Down
4 changes: 2 additions & 2 deletions e2e/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -281,7 +281,7 @@ func execCommandInPod(f *framework.Framework, c, ns string, opt *metav1.ListOpti
if stdErr != "" {
e2elog.Logf("stdErr occurred: %v", stdErr)
}
Expect(err).Should(BeNil())
Expect(err).ShouldNot(HaveOccurred())
return stdOut, stdErr
}

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

return framework.ExecOptions{
Command: cmd,
Expand Down
1 change: 1 addition & 0 deletions pkg/csi-common/controllerserver-default.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ See the License for the specific language governing permissions and
limitations under the License.
*/

//nolint:revive // csi spec
package csicommon

import (
Expand Down
1 change: 1 addition & 0 deletions pkg/csi-common/identityserver-default.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ See the License for the specific language governing permissions and
limitations under the License.
*/

//nolint:revive // csi spec
package csicommon

import (
Expand Down
1 change: 1 addition & 0 deletions pkg/csi-common/nodeserver-default.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ See the License for the specific language governing permissions and
limitations under the License.
*/

//nolint:revive // csi spec
package csicommon

import (
Expand Down
12 changes: 6 additions & 6 deletions pkg/spdk/controllerserver.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ type volume struct {
mtx sync.Mutex // per volume lock to serialize DeleteVolume requests
}

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

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

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

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

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

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

Expand Down Expand Up @@ -251,7 +251,7 @@ func (cs *controllerServer) CreateSnapshot(ctx context.Context, req *csi.CreateS
}, nil
}

func (cs *controllerServer) DeleteSnapshot(ctx context.Context, req *csi.DeleteSnapshotRequest) (*csi.DeleteSnapshotResponse, error) {
func (cs *controllerServer) DeleteSnapshot(_ context.Context, req *csi.DeleteSnapshotRequest) (*csi.DeleteSnapshotResponse, error) {
snapshotID := req.SnapshotId
cs.mtxSnapshot.RLock()
exSnap, exists := cs.snapshotsIdem[snapshotID]
Expand Down
2 changes: 1 addition & 1 deletion pkg/spdk/identityserver.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ func newIdentityServer(d *csicommon.CSIDriver) *identityServer {
}
}

func (ids *identityServer) GetPluginCapabilities(ctx context.Context, req *csi.GetPluginCapabilitiesRequest) (*csi.GetPluginCapabilitiesResponse, error) {
func (ids *identityServer) GetPluginCapabilities(_ context.Context, _ *csi.GetPluginCapabilitiesRequest) (*csi.GetPluginCapabilitiesResponse, error) {
return &csi.GetPluginCapabilitiesResponse{
Capabilities: []*csi.PluginCapability{
{
Expand Down
10 changes: 5 additions & 5 deletions pkg/spdk/nodeserver.go
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ func newNodeServer(d *csicommon.CSIDriver) (*nodeServer, error) {
return ns, nil
}

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

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

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

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

func (ns *nodeServer) NodeGetCapabilities(ctx context.Context, req *csi.NodeGetCapabilitiesRequest) (*csi.NodeGetCapabilitiesResponse, error) {
func (ns *nodeServer) NodeGetCapabilities(_ context.Context, _ *csi.NodeGetCapabilitiesRequest) (*csi.NodeGetCapabilitiesResponse, error) {
return &csi.NodeGetCapabilitiesResponse{
Capabilities: []*csi.NodeServiceCapability{
{
Expand Down
1 change: 0 additions & 1 deletion pkg/util/jsonrpc.go
Original file line number Diff line number Diff line change
Expand Up @@ -266,7 +266,6 @@ func (client *rpcClient) call(method string, args, result interface{}) error {
}

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

0 comments on commit c1b7ebc

Please sign in to comment.