From 6454dc713f871badb5f984c235fdbb80e4e3be85 Mon Sep 17 00:00:00 2001 From: Mikko Ylinen Date: Thu, 14 Aug 2025 08:36:27 +0300 Subject: [PATCH] build: use Go 1.25 and trixie golangci-lint 2.4.0 deprecates wsl and suggests wsl_v5 which finds many new places to fix. Leave these alone and simply disable wsl. noctx linter errors on net.Listen() and prefers ListenConfig. Signed-off-by: Mikko Ylinen --- .github/workflows/lib-validate.yaml | 2 +- .golangci.yml | 6 ------ Makefile | 4 ++-- build/docker/build-image.sh | 2 +- build/docker/intel-deviceplugin-operator.Dockerfile | 2 +- build/docker/intel-dlb-initcontainer.Dockerfile | 2 +- build/docker/intel-dlb-plugin.Dockerfile | 2 +- build/docker/intel-dsa-plugin.Dockerfile | 2 +- build/docker/intel-fpga-admissionwebhook.Dockerfile | 2 +- build/docker/intel-fpga-initcontainer.Dockerfile | 2 +- build/docker/intel-fpga-plugin.Dockerfile | 2 +- build/docker/intel-gpu-fakedev.Dockerfile | 2 +- build/docker/intel-gpu-initcontainer.Dockerfile | 2 +- build/docker/intel-gpu-levelzero.Dockerfile | 4 ++-- build/docker/intel-gpu-plugin.Dockerfile | 2 +- build/docker/intel-iaa-plugin.Dockerfile | 2 +- build/docker/intel-npu-plugin.Dockerfile | 2 +- build/docker/intel-qat-initcontainer.Dockerfile | 2 +- build/docker/intel-qat-plugin.Dockerfile | 2 +- build/docker/intel-sgx-admissionwebhook.Dockerfile | 2 +- build/docker/intel-sgx-initcontainer.Dockerfile | 2 +- build/docker/intel-sgx-plugin.Dockerfile | 2 +- build/docker/intel-xpumanager-sidecar.Dockerfile | 2 +- build/docker/lib/golang_base.docker | 2 +- build/docker/templates/intel-gpu-levelzero.Dockerfile.in | 4 ++-- cmd/gpu_levelzero/main.go | 4 +++- cmd/gpu_plugin/levelzeroservice/levelzero_service_test.go | 4 +++- go.mod | 2 +- pkg/deviceplugin/server.go | 4 +++- pkg/deviceplugin/server_test.go | 4 +++- 30 files changed, 40 insertions(+), 38 deletions(-) diff --git a/.github/workflows/lib-validate.yaml b/.github/workflows/lib-validate.yaml index efb98f774..7c721e29c 100644 --- a/.github/workflows/lib-validate.yaml +++ b/.github/workflows/lib-validate.yaml @@ -46,7 +46,7 @@ jobs: - name: golangci-lint uses: golangci/golangci-lint-action@4afd733a84b1f43292c63897423277bb7f4313a9 # v7 with: - version: v2.1.6 + version: v2.4.0 args: -v --timeout 5m build: name: Build and check device plugins diff --git a/.golangci.yml b/.golangci.yml index c04d6d068..faab8225d 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -29,7 +29,6 @@ linters: - unconvert - unused - whitespace - - wsl settings: gocognit: min-complexity: 31 @@ -60,16 +59,11 @@ linters: - linters: - gocognit - gocyclo - - wsl path: _test\.go - linters: - gocognit - gocyclo - - wsl path: test/e2e/ - - linters: - - wsl - path: cmd/gpu_fakedev/ - linters: - goconst path: (.+)_test\.go diff --git a/Makefile b/Makefile index 543cbb688..ccf85ad69 100644 --- a/Makefile +++ b/Makefile @@ -10,7 +10,7 @@ EXTRA_BUILD_ARGS ?= "" CERT_MANAGER_VERSION ?= v1.15.2 CONTROLLER_GEN_VERSION ?= v0.18.0 -GOLANGCI_LINT_VERSION ?= v2.1.6 +GOLANGCI_LINT_VERSION ?= v2.4.0 KIND_VERSION ?= v0.23.0 GOLICENSES_VERSION ?= v1.6.0 # Default bundle image tag @@ -170,7 +170,7 @@ e2e-spr: pre-pull: ifeq ($(TAG),devel) - @$(BUILDER) pull golang:1.24-bookworm + @$(BUILDER) pull golang:1.25-trixie @$(BUILDER) pull debian:unstable-slim @$(BUILDER) pull ubuntu:22.04 endif diff --git a/build/docker/build-image.sh b/build/docker/build-image.sh index 032603f1f..ea2185a29 100755 --- a/build/docker/build-image.sh +++ b/build/docker/build-image.sh @@ -31,7 +31,7 @@ fi BUILD_ARGS="${BUILD_ARGS} \ --build-arg FINAL_BASE=gcr.io/distroless/static \ - --build-arg BUILD_BASE=golang:1.24-bookworm \ + --build-arg BUILD_BASE=golang:1.25-trixie \ --build-arg FINAL_BASE_DYN=debian:unstable-slim \ --build-arg ROCKYLINUX=0" diff --git a/build/docker/intel-deviceplugin-operator.Dockerfile b/build/docker/intel-deviceplugin-operator.Dockerfile index ff06d2f47..f8b9b05f1 100644 --- a/build/docker/intel-deviceplugin-operator.Dockerfile +++ b/build/docker/intel-deviceplugin-operator.Dockerfile @@ -34,7 +34,7 @@ ARG FINAL_BASE=registry.access.redhat.com/ubi9-micro:latest ## ## This is used on release branches before tagging a stable version. ## The main branch defaults to using the latest Golang base image. -ARG GOLANG_BASE=golang:1.24-bookworm +ARG GOLANG_BASE=golang:1.25-trixie ### FROM ${GOLANG_BASE} AS builder ARG DIR=/intel-device-plugins-for-kubernetes diff --git a/build/docker/intel-dlb-initcontainer.Dockerfile b/build/docker/intel-dlb-initcontainer.Dockerfile index 986efa604..546b64811 100644 --- a/build/docker/intel-dlb-initcontainer.Dockerfile +++ b/build/docker/intel-dlb-initcontainer.Dockerfile @@ -33,7 +33,7 @@ ARG FINAL_BASE=registry.access.redhat.com/ubi9-micro:latest ## ## This is used on release branches before tagging a stable version. ## The main branch defaults to using the latest Golang base image. -ARG GOLANG_BASE=golang:1.24-bookworm +ARG GOLANG_BASE=golang:1.25-trixie ### FROM ${GOLANG_BASE} AS builder ARG DIR=/intel-device-plugins-for-kubernetes diff --git a/build/docker/intel-dlb-plugin.Dockerfile b/build/docker/intel-dlb-plugin.Dockerfile index 7e61ae082..f19da4e22 100644 --- a/build/docker/intel-dlb-plugin.Dockerfile +++ b/build/docker/intel-dlb-plugin.Dockerfile @@ -34,7 +34,7 @@ ARG FINAL_BASE=registry.access.redhat.com/ubi9-micro:latest ## ## This is used on release branches before tagging a stable version. ## The main branch defaults to using the latest Golang base image. -ARG GOLANG_BASE=golang:1.24-bookworm +ARG GOLANG_BASE=golang:1.25-trixie ### FROM ${GOLANG_BASE} AS builder ARG DIR=/intel-device-plugins-for-kubernetes diff --git a/build/docker/intel-dsa-plugin.Dockerfile b/build/docker/intel-dsa-plugin.Dockerfile index a7466696e..c8467e1de 100644 --- a/build/docker/intel-dsa-plugin.Dockerfile +++ b/build/docker/intel-dsa-plugin.Dockerfile @@ -34,7 +34,7 @@ ARG FINAL_BASE=registry.access.redhat.com/ubi9-micro:latest ## ## This is used on release branches before tagging a stable version. ## The main branch defaults to using the latest Golang base image. -ARG GOLANG_BASE=golang:1.24-bookworm +ARG GOLANG_BASE=golang:1.25-trixie ### FROM ${GOLANG_BASE} AS builder ARG DIR=/intel-device-plugins-for-kubernetes diff --git a/build/docker/intel-fpga-admissionwebhook.Dockerfile b/build/docker/intel-fpga-admissionwebhook.Dockerfile index d3b73ecf7..d0a4a0cce 100644 --- a/build/docker/intel-fpga-admissionwebhook.Dockerfile +++ b/build/docker/intel-fpga-admissionwebhook.Dockerfile @@ -34,7 +34,7 @@ ARG FINAL_BASE=registry.access.redhat.com/ubi9-micro:latest ## ## This is used on release branches before tagging a stable version. ## The main branch defaults to using the latest Golang base image. -ARG GOLANG_BASE=golang:1.24-bookworm +ARG GOLANG_BASE=golang:1.25-trixie ### FROM ${GOLANG_BASE} AS builder ARG DIR=/intel-device-plugins-for-kubernetes diff --git a/build/docker/intel-fpga-initcontainer.Dockerfile b/build/docker/intel-fpga-initcontainer.Dockerfile index d35455f23..4eb4ac42c 100644 --- a/build/docker/intel-fpga-initcontainer.Dockerfile +++ b/build/docker/intel-fpga-initcontainer.Dockerfile @@ -33,7 +33,7 @@ ARG FINAL_BASE=registry.access.redhat.com/ubi9-micro:latest ## ## This is used on release branches before tagging a stable version. ## The main branch defaults to using the latest Golang base image. -ARG GOLANG_BASE=golang:1.24-bookworm +ARG GOLANG_BASE=golang:1.25-trixie ### FROM ${GOLANG_BASE} AS builder ARG DIR=/intel-device-plugins-for-kubernetes diff --git a/build/docker/intel-fpga-plugin.Dockerfile b/build/docker/intel-fpga-plugin.Dockerfile index 623c34645..9c1d77966 100644 --- a/build/docker/intel-fpga-plugin.Dockerfile +++ b/build/docker/intel-fpga-plugin.Dockerfile @@ -34,7 +34,7 @@ ARG FINAL_BASE=registry.access.redhat.com/ubi9-micro:latest ## ## This is used on release branches before tagging a stable version. ## The main branch defaults to using the latest Golang base image. -ARG GOLANG_BASE=golang:1.24-bookworm +ARG GOLANG_BASE=golang:1.25-trixie ### FROM ${GOLANG_BASE} AS builder ARG DIR=/intel-device-plugins-for-kubernetes diff --git a/build/docker/intel-gpu-fakedev.Dockerfile b/build/docker/intel-gpu-fakedev.Dockerfile index d8838254c..f4a5d7733 100644 --- a/build/docker/intel-gpu-fakedev.Dockerfile +++ b/build/docker/intel-gpu-fakedev.Dockerfile @@ -34,7 +34,7 @@ ARG FINAL_BASE=registry.access.redhat.com/ubi9-micro:latest ## ## This is used on release branches before tagging a stable version. ## The main branch defaults to using the latest Golang base image. -ARG GOLANG_BASE=golang:1.24-bookworm +ARG GOLANG_BASE=golang:1.25-trixie ### FROM ${GOLANG_BASE} AS builder ARG DIR=/intel-device-plugins-for-kubernetes diff --git a/build/docker/intel-gpu-initcontainer.Dockerfile b/build/docker/intel-gpu-initcontainer.Dockerfile index 4a2c2e6e3..7723ade62 100644 --- a/build/docker/intel-gpu-initcontainer.Dockerfile +++ b/build/docker/intel-gpu-initcontainer.Dockerfile @@ -33,7 +33,7 @@ ARG FINAL_BASE=registry.access.redhat.com/ubi9-micro:latest ## ## This is used on release branches before tagging a stable version. ## The main branch defaults to using the latest Golang base image. -ARG GOLANG_BASE=golang:1.24-bookworm +ARG GOLANG_BASE=golang:1.25-trixie ### FROM ${GOLANG_BASE} AS builder ARG DIR=/intel-device-plugins-for-kubernetes diff --git a/build/docker/intel-gpu-levelzero.Dockerfile b/build/docker/intel-gpu-levelzero.Dockerfile index b086f2007..cf04f45f9 100644 --- a/build/docker/intel-gpu-levelzero.Dockerfile +++ b/build/docker/intel-gpu-levelzero.Dockerfile @@ -24,7 +24,7 @@ ARG ROCKYLINUX=1 ARG BUILD_BASE=rockylinux:9 ARG FINAL_BASE_DYN=registry.access.redhat.com/ubi9/ubi-minimal:9.3 ### -## Use the BUILD_BASE when either the a) golang-bookworm is updated to a newer glibc +## Use the BUILD_BASE when either the a) golang-trixie is updated to a newer glibc ## or b) the intel-igc-core libraries are fixed to not to demand a newer glibc FROM ${FINAL_BASE_DYN} AS builder ARG DIR=/intel-device-plugins-for-kubernetes @@ -37,7 +37,7 @@ ENV LDFLAGS="all=-linkmode=external -s -w" ARG GOLICENSES_VERSION ARG CMD ARG ROCKYLINUX -ARG CGO_VERSION=1.24 +ARG CGO_VERSION=1.25 RUN mkdir /runtime RUN if [ $ROCKYLINUX -eq 0 ]; then \ apt-get update && apt-get install --no-install-recommends -y wget jq curl libc6-dev ocl-icd-libopencl1 gcc ca-certificates && \ diff --git a/build/docker/intel-gpu-plugin.Dockerfile b/build/docker/intel-gpu-plugin.Dockerfile index 8ac0a9c8e..4730aa2e8 100644 --- a/build/docker/intel-gpu-plugin.Dockerfile +++ b/build/docker/intel-gpu-plugin.Dockerfile @@ -34,7 +34,7 @@ ARG FINAL_BASE=registry.access.redhat.com/ubi9-micro:latest ## ## This is used on release branches before tagging a stable version. ## The main branch defaults to using the latest Golang base image. -ARG GOLANG_BASE=golang:1.24-bookworm +ARG GOLANG_BASE=golang:1.25-trixie ### FROM ${GOLANG_BASE} AS builder ARG DIR=/intel-device-plugins-for-kubernetes diff --git a/build/docker/intel-iaa-plugin.Dockerfile b/build/docker/intel-iaa-plugin.Dockerfile index 68def7fde..401bea2b8 100644 --- a/build/docker/intel-iaa-plugin.Dockerfile +++ b/build/docker/intel-iaa-plugin.Dockerfile @@ -34,7 +34,7 @@ ARG FINAL_BASE=registry.access.redhat.com/ubi9-micro:latest ## ## This is used on release branches before tagging a stable version. ## The main branch defaults to using the latest Golang base image. -ARG GOLANG_BASE=golang:1.24-bookworm +ARG GOLANG_BASE=golang:1.25-trixie ### FROM ${GOLANG_BASE} AS builder ARG DIR=/intel-device-plugins-for-kubernetes diff --git a/build/docker/intel-npu-plugin.Dockerfile b/build/docker/intel-npu-plugin.Dockerfile index bd457d923..77fd829be 100644 --- a/build/docker/intel-npu-plugin.Dockerfile +++ b/build/docker/intel-npu-plugin.Dockerfile @@ -34,7 +34,7 @@ ARG FINAL_BASE=registry.access.redhat.com/ubi9-micro:latest ## ## This is used on release branches before tagging a stable version. ## The main branch defaults to using the latest Golang base image. -ARG GOLANG_BASE=golang:1.24-bookworm +ARG GOLANG_BASE=golang:1.25-trixie ### FROM ${GOLANG_BASE} AS builder ARG DIR=/intel-device-plugins-for-kubernetes diff --git a/build/docker/intel-qat-initcontainer.Dockerfile b/build/docker/intel-qat-initcontainer.Dockerfile index 5362a60b8..48bf182f5 100644 --- a/build/docker/intel-qat-initcontainer.Dockerfile +++ b/build/docker/intel-qat-initcontainer.Dockerfile @@ -33,7 +33,7 @@ ARG FINAL_BASE=registry.access.redhat.com/ubi9-micro:latest ## ## This is used on release branches before tagging a stable version. ## The main branch defaults to using the latest Golang base image. -ARG GOLANG_BASE=golang:1.24-bookworm +ARG GOLANG_BASE=golang:1.25-trixie ### FROM ${GOLANG_BASE} AS builder ARG DIR=/intel-device-plugins-for-kubernetes diff --git a/build/docker/intel-qat-plugin.Dockerfile b/build/docker/intel-qat-plugin.Dockerfile index 94724f708..21b0c7949 100644 --- a/build/docker/intel-qat-plugin.Dockerfile +++ b/build/docker/intel-qat-plugin.Dockerfile @@ -34,7 +34,7 @@ ARG FINAL_BASE=registry.access.redhat.com/ubi9-micro:latest ## ## This is used on release branches before tagging a stable version. ## The main branch defaults to using the latest Golang base image. -ARG GOLANG_BASE=golang:1.24-bookworm +ARG GOLANG_BASE=golang:1.25-trixie ### FROM ${GOLANG_BASE} AS builder ARG DIR=/intel-device-plugins-for-kubernetes diff --git a/build/docker/intel-sgx-admissionwebhook.Dockerfile b/build/docker/intel-sgx-admissionwebhook.Dockerfile index 35a414b04..cbc2a095b 100644 --- a/build/docker/intel-sgx-admissionwebhook.Dockerfile +++ b/build/docker/intel-sgx-admissionwebhook.Dockerfile @@ -34,7 +34,7 @@ ARG FINAL_BASE=registry.access.redhat.com/ubi9-micro:latest ## ## This is used on release branches before tagging a stable version. ## The main branch defaults to using the latest Golang base image. -ARG GOLANG_BASE=golang:1.24-bookworm +ARG GOLANG_BASE=golang:1.25-trixie ### FROM ${GOLANG_BASE} AS builder ARG DIR=/intel-device-plugins-for-kubernetes diff --git a/build/docker/intel-sgx-initcontainer.Dockerfile b/build/docker/intel-sgx-initcontainer.Dockerfile index 0f621be2f..0a5778839 100644 --- a/build/docker/intel-sgx-initcontainer.Dockerfile +++ b/build/docker/intel-sgx-initcontainer.Dockerfile @@ -33,7 +33,7 @@ ARG FINAL_BASE=registry.access.redhat.com/ubi9-micro:latest ## ## This is used on release branches before tagging a stable version. ## The main branch defaults to using the latest Golang base image. -ARG GOLANG_BASE=golang:1.24-bookworm +ARG GOLANG_BASE=golang:1.25-trixie ### FROM ${GOLANG_BASE} AS builder ARG DIR=/intel-device-plugins-for-kubernetes diff --git a/build/docker/intel-sgx-plugin.Dockerfile b/build/docker/intel-sgx-plugin.Dockerfile index d5fe01606..8f5053778 100644 --- a/build/docker/intel-sgx-plugin.Dockerfile +++ b/build/docker/intel-sgx-plugin.Dockerfile @@ -34,7 +34,7 @@ ARG FINAL_BASE=registry.access.redhat.com/ubi9-micro:latest ## ## This is used on release branches before tagging a stable version. ## The main branch defaults to using the latest Golang base image. -ARG GOLANG_BASE=golang:1.24-bookworm +ARG GOLANG_BASE=golang:1.25-trixie ### FROM ${GOLANG_BASE} AS builder ARG DIR=/intel-device-plugins-for-kubernetes diff --git a/build/docker/intel-xpumanager-sidecar.Dockerfile b/build/docker/intel-xpumanager-sidecar.Dockerfile index 3c7fc655b..78d6733f1 100644 --- a/build/docker/intel-xpumanager-sidecar.Dockerfile +++ b/build/docker/intel-xpumanager-sidecar.Dockerfile @@ -34,7 +34,7 @@ ARG FINAL_BASE=registry.access.redhat.com/ubi9-micro:latest ## ## This is used on release branches before tagging a stable version. ## The main branch defaults to using the latest Golang base image. -ARG GOLANG_BASE=golang:1.24-bookworm +ARG GOLANG_BASE=golang:1.25-trixie ### FROM ${GOLANG_BASE} AS builder ARG DIR=/intel-device-plugins-for-kubernetes diff --git a/build/docker/lib/golang_base.docker b/build/docker/lib/golang_base.docker index 2702d8e61..6fccce310 100644 --- a/build/docker/lib/golang_base.docker +++ b/build/docker/lib/golang_base.docker @@ -5,5 +5,5 @@ ## ## This is used on release branches before tagging a stable version. ## The main branch defaults to using the latest Golang base image. -ARG GOLANG_BASE=golang:1.24-bookworm +ARG GOLANG_BASE=golang:1.25-trixie ### diff --git a/build/docker/templates/intel-gpu-levelzero.Dockerfile.in b/build/docker/templates/intel-gpu-levelzero.Dockerfile.in index 6a2daed09..d109c619c 100644 --- a/build/docker/templates/intel-gpu-levelzero.Dockerfile.in +++ b/build/docker/templates/intel-gpu-levelzero.Dockerfile.in @@ -12,7 +12,7 @@ ARG BUILD_BASE=rockylinux:9 ARG FINAL_BASE_DYN=registry.access.redhat.com/ubi9/ubi-minimal:9.3 ### -## Use the BUILD_BASE when either the a) golang-bookworm is updated to a newer glibc +## Use the BUILD_BASE when either the a) golang-trixie is updated to a newer glibc ## or b) the intel-igc-core libraries are fixed to not to demand a newer glibc FROM ${FINAL_BASE_DYN} AS builder @@ -28,7 +28,7 @@ ENV LDFLAGS="all=-linkmode=external -s -w" ARG GOLICENSES_VERSION ARG CMD ARG ROCKYLINUX -ARG CGO_VERSION=1.24 +ARG CGO_VERSION=1.25 RUN mkdir /runtime diff --git a/cmd/gpu_levelzero/main.go b/cmd/gpu_levelzero/main.go index 1280bf014..a877d50d6 100644 --- a/cmd/gpu_levelzero/main.go +++ b/cmd/gpu_levelzero/main.go @@ -203,7 +203,9 @@ func main() { } }) - lis, err := net.Listen("unix", *socketPath) + var lc net.ListenConfig + + lis, err := lc.Listen(context.Background(), "unix", *socketPath) if err != nil { klog.Fatalf("failed to listen: %v", err) } diff --git a/cmd/gpu_plugin/levelzeroservice/levelzero_service_test.go b/cmd/gpu_plugin/levelzeroservice/levelzero_service_test.go index 471a4c291..de2a148cf 100644 --- a/cmd/gpu_plugin/levelzeroservice/levelzero_service_test.go +++ b/cmd/gpu_plugin/levelzeroservice/levelzero_service_test.go @@ -43,7 +43,9 @@ type mockServer struct { } func (m *mockServer) serve(socketPath string) { - lis, err := net.Listen("unix", socketPath) + var lc net.ListenConfig + + lis, err := lc.Listen(context.Background(), "unix", socketPath) if err != nil { log.Fatalf("failed to listen: %v", err) } diff --git a/go.mod b/go.mod index d8c0cc636..89686243a 100644 --- a/go.mod +++ b/go.mod @@ -1,6 +1,6 @@ module github.com/intel/intel-device-plugins-for-kubernetes -go 1.24.0 +go 1.25.0 require ( github.com/fsnotify/fsnotify v1.9.0 diff --git a/pkg/deviceplugin/server.go b/pkg/deviceplugin/server.go index ed2cb1779..4b28139d1 100644 --- a/pkg/deviceplugin/server.go +++ b/pkg/deviceplugin/server.go @@ -272,7 +272,9 @@ func (srv *server) setupAndServe(namespace string, devicePluginPath string, kube // We don't care if the plugin's socket file doesn't exist. _ = os.Remove(pluginSocket) - lis, err := net.Listen("unix", pluginSocket) + var lc net.ListenConfig + + lis, err := lc.Listen(context.Background(), "unix", pluginSocket) if err != nil { return errors.Wrap(err, "Failed to listen to plugin socket") } diff --git a/pkg/deviceplugin/server_test.go b/pkg/deviceplugin/server_test.go index d22a78695..02628ef0d 100644 --- a/pkg/deviceplugin/server_test.go +++ b/pkg/deviceplugin/server_test.go @@ -98,7 +98,9 @@ func (k *kubeletStub) Register(ctx context.Context, r *pluginapi.RegisterRequest func (k *kubeletStub) start() error { _ = os.Remove(k.socket) - s, err := net.Listen("unix", k.socket) + var lc net.ListenConfig + + s, err := lc.Listen(context.Background(), "unix", k.socket) if err != nil { return errors.Wrap(err, "Can't listen at the socket") }