From 54f9d730e97055d10dd1d4daed61739bd57507dd Mon Sep 17 00:00:00 2001 From: Mikko Ylinen Date: Mon, 29 Apr 2024 10:45:14 +0300 Subject: [PATCH] ci: move to golangci-lint v1.57.2 Signed-off-by: Mikko Ylinen --- .github/workflows/lib-validate.yaml | 2 +- .golangci.yml | 9 ++++++++- Makefile | 2 +- cmd/fpga_tool/fpga_tool.go | 2 ++ cmd/gpu_plugin/rm/gpu_plugin_resource_manager.go | 1 + cmd/qat_plugin/kerneldrv/kerneldrv.go | 2 ++ cmd/xpumanager_sidecar/main.go | 1 + pkg/controllers/dlb/controller.go | 1 + pkg/controllers/reconciler.go | 2 ++ pkg/controllers/sgx/controller.go | 1 + 10 files changed, 20 insertions(+), 3 deletions(-) diff --git a/.github/workflows/lib-validate.yaml b/.github/workflows/lib-validate.yaml index b6242edf6..9e7906f04 100644 --- a/.github/workflows/lib-validate.yaml +++ b/.github/workflows/lib-validate.yaml @@ -43,7 +43,7 @@ jobs: - name: golangci-lint uses: golangci/golangci-lint-action@v5 with: - version: v1.55.2 + version: v1.57.2 args: -v --timeout 5m build: diff --git a/.golangci.yml b/.golangci.yml index 700cb5304..3c5f1c62d 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -52,7 +52,7 @@ linters-settings: goconst: ignore-tests: true govet: - check-shadowing: true + shadow: true enable: - "fieldalignment" gocyclo: @@ -65,3 +65,10 @@ issues: - path: _test\.go linters: - gocognit + - wsl + - path: test/e2e/ + linters: + - wsl + - path: cmd/gpu_fakedev/ + linters: + - wsl diff --git a/Makefile b/Makefile index 69686f522..b621784fe 100644 --- a/Makefile +++ b/Makefile @@ -10,7 +10,7 @@ EXTRA_BUILD_ARGS ?= "" CERT_MANAGER_VERSION ?= v1.14.2 CONTROLLER_GEN_VERSION ?= v0.14.0 -GOLANGCI_LINT_VERSION ?= v1.55.2 +GOLANGCI_LINT_VERSION ?= v1.57.2 KIND_VERSION ?= v0.21.0 GOLICENSES_VERSION ?= v1.6.0 # Default bundle image tag diff --git a/cmd/fpga_tool/fpga_tool.go b/cmd/fpga_tool/fpga_tool.go index 931335998..90f2f626c 100644 --- a/cmd/fpga_tool/fpga_tool.go +++ b/cmd/fpga_tool/fpga_tool.go @@ -159,6 +159,7 @@ func installBitstream(fname string, dryRun, force, quiet bool) (err error) { return errors.Wrap(err, "can't create destination file") } defer dst.Close() + _, err = io.Copy(dst, src) return err @@ -170,6 +171,7 @@ func printBitstreamInfo(fname string, quiet bool) (err error) { return } defer info.Close() + fmt.Printf("Bitstream file : %q\n", fname) fmt.Printf("Interface UUID : %q\n", info.InterfaceUUID()) fmt.Printf("Accelerator Type UUID : %q\n", info.AcceleratorTypeUUID()) diff --git a/cmd/gpu_plugin/rm/gpu_plugin_resource_manager.go b/cmd/gpu_plugin/rm/gpu_plugin_resource_manager.go index 4a5046da0..95c7c2a84 100644 --- a/cmd/gpu_plugin/rm/gpu_plugin_resource_manager.go +++ b/cmd/gpu_plugin/rm/gpu_plugin_resource_manager.go @@ -839,6 +839,7 @@ func containerCards(pod *v1.Pod, gpuUsingContainerIndex int) []string { klog.V(3).Infof("Cards for container nr %v in pod %v are %v", gpuUsingContainerIndex, getPodKey(pod), cards) return cards } + i++ } } diff --git a/cmd/qat_plugin/kerneldrv/kerneldrv.go b/cmd/qat_plugin/kerneldrv/kerneldrv.go index 617928624..cfed3021b 100644 --- a/cmd/qat_plugin/kerneldrv/kerneldrv.go +++ b/cmd/qat_plugin/kerneldrv/kerneldrv.go @@ -104,6 +104,7 @@ func getDevTree(sysfs string, qatDevs []device, config map[string]section) (dpap } deviceInfo := dpapi.NewDeviceInfo(pluginapi.Healthy, devs, nil, envs, nil) devTree.AddDevice(devType, fmt.Sprintf("%s_%s_%d", sname, ep.id, i), deviceInfo) + uniqID++ } @@ -216,6 +217,7 @@ func (dp *DevicePlugin) parseConfigs(devices []device) (map[string]section, erro if err != nil { return nil, errors.Wrap(err, "failed to parse device config") } + devNum++ for _, section := range config.Sections() { diff --git a/cmd/xpumanager_sidecar/main.go b/cmd/xpumanager_sidecar/main.go index 402360500..98a82e806 100644 --- a/cmd/xpumanager_sidecar/main.go +++ b/cmd/xpumanager_sidecar/main.go @@ -193,6 +193,7 @@ func (xms *xpuManagerSidecar) GetTopologyFromXPUMMetrics(data []byte) (topologyI value = *metric.Gauge.Value } else if metric.Untyped != nil { klog.V(5).Info("metric is of type untyped") + value = *metric.Untyped.Value } else { klog.Warningf("Unknown/unsupported metric type: %v", metric) diff --git a/pkg/controllers/dlb/controller.go b/pkg/controllers/dlb/controller.go index 0edfcb2ee..ba770a528 100644 --- a/pkg/controllers/dlb/controller.go +++ b/pkg/controllers/dlb/controller.go @@ -118,6 +118,7 @@ func (c *controller) UpdateDaemonSet(rawObj client.Object, ds *apps.DaemonSet) ( containers := ds.Spec.Template.Spec.InitContainers if len(containers) != 1 || containers[0].Image != dp.Spec.InitImage { setInitContainer(&ds.Spec.Template.Spec, dp.Spec) + updated = true } } diff --git a/pkg/controllers/reconciler.go b/pkg/controllers/reconciler.go index fde40d31e..45d119757 100644 --- a/pkg/controllers/reconciler.go +++ b/pkg/controllers/reconciler.go @@ -300,6 +300,7 @@ func indexDaemonSets(ctx context.Context, mgr ctrl.Manager, apiGVString, pluginK // grab the DaemonSet object, extract the owner... ds := rawObj.(*apps.DaemonSet) owner := metav1.GetControllerOf(ds) + if owner == nil { return nil } @@ -320,6 +321,7 @@ func indexPods(ctx context.Context, mgr ctrl.Manager, apiGVString, pluginKind, o // grab the Pod object, extract the owner... pod := rawObj.(*v1.Pod) owner := metav1.GetControllerOf(pod) + if owner == nil { return nil } diff --git a/pkg/controllers/sgx/controller.go b/pkg/controllers/sgx/controller.go index 0c7a2cb32..05a7f1635 100644 --- a/pkg/controllers/sgx/controller.go +++ b/pkg/controllers/sgx/controller.go @@ -167,6 +167,7 @@ func (c *controller) UpdateDaemonSet(rawObj client.Object, ds *apps.DaemonSet) ( } } else { setInitContainer(&ds.Spec.Template.Spec, dp.Spec.InitImage) + updated = true }