2020-08-17 07:18:02 +00:00
|
|
|
#!/usr/bin/env bash
|
2020-04-02 22:58:23 +00:00
|
|
|
|
|
|
|
# Need to run linter twice to cover all the build tags code paths
|
2020-08-17 07:18:02 +00:00
|
|
|
set -e
|
2020-04-02 22:58:23 +00:00
|
|
|
|
|
|
|
declare -A BUILD_TAGS
|
2020-04-17 11:34:14 +00:00
|
|
|
# TODO: add systemd tag
|
2021-02-09 18:23:32 +00:00
|
|
|
BUILD_TAGS[default]="apparmor,seccomp,selinux,linter"
|
2020-11-18 21:12:33 +00:00
|
|
|
BUILD_TAGS[abi]="${BUILD_TAGS[default]},!remoteclient"
|
|
|
|
BUILD_TAGS[tunnel]="${BUILD_TAGS[default]},remote,remoteclient"
|
2020-04-17 11:34:14 +00:00
|
|
|
|
|
|
|
declare -A SKIP_DIRS
|
|
|
|
SKIP_DIRS[abi]=""
|
2020-06-03 13:33:52 +00:00
|
|
|
# TODO: add "remote" build tag to pkg/api
|
2020-04-17 11:34:14 +00:00
|
|
|
SKIP_DIRS[tunnel]="pkg/api"
|
2020-04-02 22:58:23 +00:00
|
|
|
|
|
|
|
[[ $1 == run ]] && shift
|
|
|
|
|
|
|
|
for i in tunnel abi; do
|
2020-04-17 11:34:14 +00:00
|
|
|
echo ""
|
|
|
|
echo Running golangci-lint for "$i"
|
|
|
|
echo Build Tags "$i": ${BUILD_TAGS[$i]}
|
|
|
|
echo Skipped directories "$i": ${SKIP_DIRS[$i]}
|
2021-01-17 16:07:04 +00:00
|
|
|
./bin/golangci-lint run --build-tags=${BUILD_TAGS[$i]} --skip-dirs=${SKIP_DIRS[$i]} "$@"
|
2020-04-02 22:58:23 +00:00
|
|
|
done
|