The linter suppression got removed in the migration to golangci-lint v2 because
it wasn't triggered for existing code, but as seen in a PR which adds a
conversion package the suppression is still needed.
Furthermore, we also want to suppress for unexported, manually written
conversion and defaulting functions because those follow the same Kubernetes
naming convention.
Redirecting stderr via a pipe raced with handling the result of the
golangci-lint invocation. We need to block the execution until sed has fully
processed all output.
Because of this race, pull-kubernetes-linter-hints jobs failed with "Please
review the above warnings" without actually showing any.
we don't need any other utils in the image the way the script is currently written, other utils are just a vuln-patch waiting to happen, and make the download larger
The advantage is that it separates the dependencies of the different tools
better. golangci-lint in particular has many dependencies and is sometimes
sensitive to the exact version being used. This way, "go get" bumps up
dependencies exactly as defined by the upstream golangci-lint module.
It's not quite self-contained because logcheck as a Go plugin for golangci-lint
must be built from the same dependencies. But it only adds one and does not
change any of the others.
While at it, the Go 1.24 "tools" directive gets used instead of the traditional
tools.go approach.
This finishes the work started in
https://github.com/kubernetes/kubernetes/pull/131113.
Changes:
- Remove TODOs for things that we don't have plans to fix.
- Add issue for older TODO.
- Reorganize and remove suppression rules so that the base check
has no unused rules.
- Document warn-unused, but don't enable it.
- Remove disabling of statistics (they are useful) and ensure that
they don't get the ERROR prefix.
- Avoid ../ prefix in paths via `run.relative-path-mode: gomod`.
github.com/client9/misspell was archived by the owner on Mar 26, 2025.
The golangci-lint team maintains a fork.
The newer code finds some misspellings which where missed before.
If the script got killed, it failed to wait properly:
Waiting for Ginkgo with pid 73873...
./hack/ginkgo-e2e.sh: line 236: wait: `{73873}': not a pid or valid job spec
"--format standard-quiet" shows log output on stderr (= klog logging) if it
occurs outside of a test (= test has leaked something). That is inconsistent
with "go test" without -v and a problem for pull-kubernetes-unit because many
tests do not clean up properly.
"pkgname-and-test-fails" hides the extra output and seems similar enough:
pkgname-and-test-fails print a line for each package and failed test output
$ gotestsum --format pkgname-and-test-fails ./test/internal/logging --count=1
✓ test/internal/logging (5.007s)
DONE 1 tests in 5.384s