...

Text file src/edge-infra.dev/hack/tools/linters/golangci-lint.sh

Documentation: edge-infra.dev/hack/tools/linters

     1#!/usr/bin/env bash
     2
     3set -o errexit
     4set -o nounset
     5set -o pipefail
     6
     7if [[ -n "${BUILD_WORKSPACE_DIRECTORY:-}" ]]; then # Running inside bazel
     8  echo "linting..." >&2
     9elif ! command -v bazel &>/dev/null; then
    10  echo "Install bazel via `just hack/bazelisk`" >&2
    11  exit 1
    12else
    13  echo "This script should be ran via 'bazel run hack/tools/linters:go'"
    14  echo "Running it for you... this time, pal"
    15  bazel run //hack/tools/linters:go
    16  exit "$?"
    17fi
    18
    19golangcilint="$(realpath "$2")"
    20lintconfig="$(realpath "$3")"
    21
    22go=$(realpath "$1")
    23export go
    24
    25export PATH=$(dirname $(dirname "$go")):$PATH
    26export PATH=$(dirname "$go"):$PATH
    27
    28cd "${BUILD_WORKSPACE_DIRECTORY}"
    29"$golangcilint" --version
    30"$go" version 
    31
    32echo "golangci-lint run -c $lintconfig ${@:4}"
    33"$golangcilint" run -c "$lintconfig" "${@:4}" --disable-all

View as plain text