Files
podman/hack/golangci-lint.sh
Paul Holzinger ee35ce86d0 enable linter for pkg/machine/e2e
Rename all files to _test.go and rename the package to e2e_test. This
makes the linter less strict about things like dot imports.

Add some unused nolint directives to silence some warnings, these can be
used to find untested options so someone could add tests for them.

Fixes #14996

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2022-07-21 18:04:10 +02:00

25 lines
677 B
Bash
Executable File

#!/usr/bin/env bash
# Need to run linter twice to cover all the build tags code paths
set -e
declare -A BUILD_TAGS
BUILD_TAGS[default]="apparmor,seccomp,selinux,linter"
BUILD_TAGS[abi]="${BUILD_TAGS[default]},systemd"
BUILD_TAGS[tunnel]="${BUILD_TAGS[default]},remote"
declare -A SKIP_DIRS
SKIP_DIRS[abi]=""
# TODO: add "remote" build tag to pkg/api
SKIP_DIRS[tunnel]="pkg/api"
[[ $1 == run ]] && shift
for i in tunnel abi; do
echo ""
echo Running golangci-lint for "$i"
echo Build Tags "$i": ${BUILD_TAGS[$i]}
echo Skipped directories "$i": ${SKIP_DIRS[$i]}
./bin/golangci-lint run --build-tags=${BUILD_TAGS[$i]} --skip-dirs=${SKIP_DIRS[$i]} "$@"
done