aboutsummaryrefslogtreecommitdiff
path: root/hack/golangci-lint.sh
blob: f4e60d8f50e5c1d2eb0be4c66887e1953577814a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#!/bin/bash -e

# Need to run linter twice to cover all the build tags code paths

declare -A BUILD_TAGS
# TODO: add systemd tag
BUILD_TAGS[default]="apparmor,seccomp,selinux"
BUILD_TAGS[abi]="${BUILD_TAGS[default]},ABISupport,varlink,!remoteclient"
BUILD_TAGS[tunnel]="${BUILD_TAGS[default]},!ABISupport,varlink,remoteclient"

declare -A SKIP_DIRS
SKIP_DIRS[abi]=""
# TODO: add "ABISupport" 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]}
  golangci-lint run --build-tags=${BUILD_TAGS[$i]} --skip-dirs=${SKIP_DIRS[$i]} "$@"
done