From cbe33cd9a8b2e3a28d784691d581eea11b6f2559 Mon Sep 17 00:00:00 2001 From: slayerjain Date: Tue, 20 Oct 2026 10:06:57 +0530 Subject: [PATCH] fix(golint): golangci-lint v2.14.0, which reads go1.27.2's export data, and a build that lints golint-1.2.46 moved to go1.27.2 (golang:1.27.2-bookworm) and kept golangci-lint v2.13.2, which cannot read that Go's export data: every package fails its typecheck on its stdlib imports, could not import cmp (... cannot decode "cmp", export data version 5 is greater than maximum supported version 4) and --new-from-patch does not filter that out. The image's own check, `golangci-lint --version`, passed it. k8s-proxy's ci.yml had already met this on golang:1.27 and moved to v2.14.0. - GOLANGCI_LINT_VERSION is v2.14.0. - The image build ends by linting a module that imports the stdlib (cmp, fmt, slices), `go 1.27.0` as keploy's are, with this image's Go: a golangci-lint that cannot read its export data fails the build, not a lint lane. Its caches go with it. On .142 (linux/amd64): the image builds with v2.14.0, and with --build-arg GOLANGCI_LINT_VERSION=v2.13.2 its build fails at that lint with the three typecheck errors above. In the v2.14.0 image, each lint lane's command over its repo's main, with that repo's config: enterprise (linux/amd64, linux/arm64 with gui, windows/arm64, tools/nativeassets) 0 issues; go-fuzzers 0 issues; api-server (go mod vendor, the whole repo, not just --new-from-patch) 0 issues; integrations (cgo on, as its lane) 0 issues. Signed-off-by: slayerjain --- keploy-ci-golint/Dockerfile | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/keploy-ci-golint/Dockerfile b/keploy-ci-golint/Dockerfile index a1e13ec..a1551e3 100644 --- a/keploy-ci-golint/Dockerfile +++ b/keploy-ci-golint/Dockerfile @@ -52,7 +52,11 @@ RUN set -eux; \ rm -f /tmp/cross-probe; \ pkg-config --exists gl x11 xcursor xi xinerama xrandr xxf86vm -ARG GOLANGCI_LINT_VERSION=v2.13.2 +# v2.14.0: the first that reads go1.27.2's export data. v2.13.1 and v2.13.2, +# under go1.27.2, fail every package's typecheck on its stdlib imports +# ("could not import cmp (... export data version 5 is greater than maximum +# supported version 4)"), and golint-1.2.46 shipped v2.13.2 on go1.27.2. +ARG GOLANGCI_LINT_VERSION=v2.14.0 # golangci-lint is installed by hand rather than by piping upstream's # install.sh, which cannot install any version we are able to use here. @@ -73,6 +77,12 @@ ARG GOLANGCI_LINT_VERSION=v2.13.2 # refuses to run when its build Go is older than the module's target, so every # version new enough for a `go 1.27.0` module hits that bug. Matching the # checksum line on the EXACT filename avoids it and keeps verification intact. +# +# Ends by linting a module that imports the stdlib, with this image's Go, so a +# golangci-lint that cannot read this Go's export data fails here, not in a +# lint lane: `golangci-lint --version`, the check before, passed v2.13.2 on +# go1.27.2, which then could not typecheck a single package. Its caches go +# with the probe, and the telemetry counters its go writes. RUN set -eux; \ version="${GOLANGCI_LINT_VERSION#v}"; \ arch="$(dpkg --print-architecture)"; \ @@ -86,4 +96,11 @@ RUN set -eux; \ tar -xzf /tmp/golangci-lint.tar.gz -C /tmp; \ install "/tmp/${name}/golangci-lint" /usr/local/bin/golangci-lint; \ rm -rf /tmp/golangci-lint.tar.gz /tmp/golangci-lint-checksums.txt "/tmp/${name}"; \ - golangci-lint --version + golangci-lint --version; \ + mkdir -p /tmp/lint-probe; \ + printf 'module probe\n\ngo 1.27.0\n' >/tmp/lint-probe/go.mod; \ + printf 'package probe\n\nimport (\n\t"cmp"\n\t"fmt"\n\t"slices"\n)\n\n// Largest is the largest of xs.\nfunc Largest(xs []int) int { return slices.MaxFunc(xs, cmp.Compare[int]) }\n\n// Show formats x.\nfunc Show(x int) string { return fmt.Sprint(x) }\n' >/tmp/lint-probe/probe.go; \ + cd /tmp/lint-probe; \ + GOCACHE=/tmp/lint-probe-cache GOLANGCI_LINT_CACHE=/tmp/lint-probe-lintcache GOFLAGS=-mod=mod golangci-lint run ./...; \ + cd /; \ + rm -rf /tmp/lint-probe /tmp/lint-probe-cache /tmp/lint-probe-lintcache /root/.config/go