1
0
mirror of https://github.com/containers/podman.git synced 2026-02-05 06:45:31 +01:00

Merge pull request #25743 from kolyshkin/freebsd-golangci-lint

Add freebsd golangci lint run; fix remaining freebsd warnings
This commit is contained in:
openshift-merge-bot[bot]
2025-04-03 18:30:54 +00:00
committed by GitHub
19 changed files with 101 additions and 125 deletions

View File

@@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash
# Run golangci-lint with different sets of build tags.
set -e
@@ -8,23 +8,29 @@ set -e
# a very old version, where modern features (like `declare -A`) are
# absent.
echo "Linting for GOOS=$GOOS"
# Special case: for Darwin and Windows only "remote" linting is possible and required.
if [[ "$GOOS" == "windows" || "$GOOS" == "darwin" ]]; then
(
set -x
./bin/golangci-lint run --build-tags="remote,containers_image_openpgp" "$@"
)
exit 0
fi
declare -a EXTRA_TAGS
# Normal case (Linux): run linter for various sets of build tags.
TAGS="apparmor,seccomp,selinux"
for EXTRA_TAGS in "" ",systemd" ",remote"; do
echo "Linting for GOOS=$GOOS"
case "$GOOS" in
windows|darwin)
# For Darwin and Windows, only "remote" linting is possible and required.
TAGS="remote,containers_image_openpgp"
;;
freebsd)
TAGS="containers_image_openpgp"
EXTRA_TAGS=(",remote")
;;
*)
# Assume Linux: run linter for various sets of build tags.
TAGS="apparmor,seccomp,selinux"
EXTRA_TAGS=(",systemd" ",remote")
esac
for EXTRA in "" "${EXTRA_TAGS[@]}"; do
# Use set -x in a subshell to make it easy for a developer to copy-paste
# the command-line to focus or debug a single, specific linting category.
(
# Make it really easy for a developer to copy-paste the command-line
# to focus or debug a single, specific linting category.
set -x
./bin/golangci-lint run --build-tags="${TAGS}${EXTRA_TAGS}" "$@"
./bin/golangci-lint run --build-tags="${TAGS}${EXTRA}" "$@"
)
done