github.com/hanks177/podman/v4@v4.1.3-0.20220613032544-16d90015bc83/hack/golangci-lint.sh (about)

     1  #!/usr/bin/env bash
     2  
     3  # Need to run linter twice to cover all the build tags code paths
     4  set -e
     5  
     6  declare -A BUILD_TAGS
     7  # TODO: add systemd tag
     8  BUILD_TAGS[default]="apparmor,seccomp,selinux,linter"
     9  BUILD_TAGS[abi]="${BUILD_TAGS[default]},!remoteclient"
    10  BUILD_TAGS[tunnel]="${BUILD_TAGS[default]},remote,remoteclient"
    11  
    12  declare -A SKIP_DIRS
    13  SKIP_DIRS[abi]="pkg/machine/e2e"
    14  # TODO: add "remote" build tag to pkg/api
    15  SKIP_DIRS[tunnel]="pkg/api,pkg/machine/e2e"
    16  
    17  [[ $1 == run ]] && shift
    18  
    19  for i in tunnel abi; do
    20    echo ""
    21    echo Running golangci-lint for "$i"
    22    echo Build Tags          "$i": ${BUILD_TAGS[$i]}
    23    echo Skipped directories "$i": ${SKIP_DIRS[$i]}
    24    ./bin/golangci-lint run --build-tags=${BUILD_TAGS[$i]} --skip-dirs=${SKIP_DIRS[$i]} "$@"
    25  done