kubeadm has replaced pkg/errors with an internal implementation, which
means that pkg/errors can be marked as unwanted (once a final
straggler is replaced).
Signed-off-by: Stephen Kitt <skitt@redhat.com>
This fixes the following issue in ci-benchmark-scheduler-perf-master:
malformed import path " ": invalid char ' '
FAIL [setup failed]
Setting the non-empty string with just a space was broken, the right way to
disable the race detector is with an empty KUBE_RACE variable. This worked
before when test-integration.sh unconditionally overwrote the KUBE_RACE
variable and stopped working when 6cb1488 started to keep whatever was
set by the caller.
This then caused an empty string to be passed as additional parameter to "go
test".
Now that all other uses have been removed, this configures depguard to
ensure that new ones aren't added outside kubeadm.
Signed-off-by: Stephen Kitt <skitt@redhat.com>
The package is unmaintained, and kubectl doesn't rely on the
functionality it provides on top of Golang errors (stack traces).
Signed-off-by: Stephen Kitt <skitt@redhat.com>
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.