#!/usr/bin/env bash set -o errexit set -o nounset set -o pipefail if [[ -n "${BUILD_WORKSPACE_DIRECTORY:-}" ]]; then # Running inside bazel echo "linting..." >&2 elif ! command -v bazel &>/dev/null; then echo "Install bazel via `just hack/bazelisk`" >&2 exit 1 else echo "This script should be ran via 'bazel run hack/tools/linters:go'" echo "Running it for you... this time, pal" bazel run //hack/tools/linters:go exit "$?" fi golangcilint="$(realpath "$2")" lintconfig="$(realpath "$3")" go=$(realpath "$1") export go export PATH=$(dirname $(dirname "$go")):$PATH export PATH=$(dirname "$go"):$PATH cd "${BUILD_WORKSPACE_DIRECTORY}" "$golangcilint" --version "$go" version echo "golangci-lint run -c $lintconfig ${@:4}" "$golangcilint" run -c "$lintconfig" "${@:4}" --disable-all