github.com/NpoolPlatform/chain-middleware@v0.0.0-20240228100535-eb1bcf896eb9/hack/verify-golangci-lint.sh (about)

     1  #!/usr/bin/env bash
     2  
     3  set -o errexit
     4  set -o nounset
     5  set -o pipefail
     6  
     7  VERSION=v1.46.2
     8  URL_BASE=https://raw.githubusercontent.com/golangci/golangci-lint
     9  URL=$URL_BASE/$VERSION/install.sh
    10  
    11  if [[ ! -f .golangci.yml ]]; then
    12      echo 'ERROR: missing .golangci.yml in repo root' >&2
    13      exit 1
    14  fi
    15  
    16  if ! command -v gofumpt; then
    17      go install mvdan.cc/gofumpt@v0.3.1
    18  fi
    19  
    20  if ! command -v golangci-lint; then
    21      curl -sfL $URL | sh -s $VERSION
    22      PATH=$PATH:bin
    23  fi
    24  
    25  golangci-lint version
    26  golangci-lint linters
    27  golangci-lint run "$@"