This is shown when golangci-lint is run with --tests=false
> test/e2e/config.go:7:2: var fedoraMinimal is unused (unused)
> fedoraMinimal = "quay.io/libpod/systemd-image:20240124"
> ^
> test/e2e/config.go:18:2: var volumeTest is unused (unused)
> volumeTest = "quay.io/libpod/volume-plugin-test-img:20220623"
> ^
Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
> pkg/machine/qemu/stubber.go:92:23: ST1016: methods on the same type should have the same receiver name (seen 1x "v", 25x "q") (staticcheck)
> func (q *QEMUStubber) CreateVM(opts define.CreateVMOpts, mc *vmconfigs.MachineConfig, builder *ignition.IgnitionBuilder) error {
> ^
Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
This amends commit 772ead253 ("Use simulated dual-stack binds when using WSL")
which started using linux tag but not for all files.
Alas, this breaks ginkgo run on Windows, so add an exclusion.
Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
Usage of splitPorts was removed by commit abc4cfb04 ("quadlet: allow
variables in PublishPort") but the function remained, as well as its
tests.
Drop those.
Found by running golangci-lint with --tests=false option.
Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
This ended up slightly more complicated than anticipated, tin part
because golangci-lint v2 dropped support for --exclude-dirs, so
linter issues with GOOS=windows and GOOS=darwin which were previously
ignored had to be fixed now.
This is also the reason why the ./hack/golangci-lint was simplified.
In addition, it now runs linters on Linux without systemd tag set.
Tested locally with:
for OS in linux windows darwin; do GOOS=$OS ./hack/golangci-lint.sh; done
Linting for GOOS=linux
+ ./bin/golangci-lint run --build-tags=apparmor,seccomp,selinux
0 issues.
+ ./bin/golangci-lint run --build-tags=apparmor,seccomp,selinux,systemd
0 issues.
+ ./bin/golangci-lint run --build-tags=apparmor,seccomp,selinux,remote
0 issues.
Linting for GOOS=windows
+ ./bin/golangci-lint run --build-tags=remote,containers_image_openpgp
0 issues.
Linting for GOOS=darwin
+ ./bin/golangci-lint run --build-tags=remote,containers_image_openpgp
0 issues.
Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
Those are not used since commit 0c587f024 ("refactor(machine,wsl):
improve operations of Windows API").
Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
Looks like this is a forgotten part of commit 9bb191df5
("[CI:MACHINE]Podman5 QEMU refactor"). The reason is,
linters for Windows skip pkg/machine/qemu, and linters
for freebsd are not run at all.
Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
With GOOS=darwin, golangci-lint complains:
> pkg/bindings/images/build_unix.go:13:24: directive `//nolint:unconvert` is unused for linter "unconvert" (nolintlint)
> Dev: uint64(st.Dev), //nolint:unconvert
> ^
Indeed, Stat_t.Dev is always uint64 on darwin
Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
Shuffle the code around to eliminate "unused" warnings when linting
with various GOOS and build tags.
The only change in functionality should be that now NewEventer
returns ErrNoJournaldLogging (rather than "unknown event logger type")
on freebsd when journald is requested.
Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
This was added by commit 84e42877a ("make lint: re-enable revive"),
making nolintlint became almost useless.
Remove the ungodly amount of unused nolint annotations.
Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
These:
> libpod/container_copy_common.go:34:16: QF1011: could omit type bool from declaration; it will be inferred from the right-hand side (staticcheck)
> locked bool = true
> ^
> libpod/container_internal_common.go:793:3: QF1006: could lift into loop condition (staticcheck)
> if maxSymLinks > 40 {
> ^
> libpod/oci_conmon_linux.go:170:2: QF1007: could merge conditional assignment into variable declaration (staticcheck)
> mustCreateCgroup := true
> ^
Should not result in any change of logic.
Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
Neither contrib nor dependencies contain any Go code:
- for contrib, this is the way since commit 6041f707c ("rm
contrib/perftest");
- for dependencies, this is the way since commit c7827957a ("ginkgo:
restructure install work flow").
Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
The only file listed was swagger.go, and it was removed by the commit
5b79cf15a ("Swagger refactor/cleanup") three years ago.
Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
Let's take a look at each enabled linter and find out if it's needed;
remove those that make no sense.
* goheader: does nothing with empty configuration;
* gomodguard: does nothing with empty configuration;
* importas: does nothing with empty configuration;
* loggercheck: this repo does not use any loggers it checks (kitlog,klog,logr,zap);
* promlinter: this repo does not use Prometheus;
* sloginit: this repo does not use slog;
* spancheck: this repo does not use opentelemetry/opencensus;
* zerologlint: this repo does not use zerolog;
Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
Instead of enabling all linters, and when disabling some of them because
we don't like them, switch to list of explicitly enabled linters. The
upside of this is we can easily upgrade golangci-lint (i.e. any new
linters won't break our CI). The downside is, we need to explicitly
enable extra linters.
To me, this is better from the maintainability perspective.
NOTE this commit does not change the configuration in any way, in other
words, the list of linters being run is the same as before. The next
commit will address this.
Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
It seems support was added into Buildah for no-new-privileges [1]
however the Podman build documentation was not updated.
Fixes#25731
[1] d4c661a774
Signed-off-by: Lewis Denny <lewis@redhat.com>
this is just a few bytes of escape codes, there is no need to depend on
a library for it. While it is not a big one it still seems better to
just write it ourselves.
Signed-off-by: Paul Holzinger <pholzing@redhat.com>