github.com/ulule/limiter/v3@v3.11.3-0.20230613131926-4cb9c1da4633/scripts/lint (about)

     1  #!/bin/bash
     2  
     3  set -eo pipefail
     4  
     5  if [[ ! -x "$(command -v go)" ]]; then
     6    echo >&2 "go runtime is required: https://golang.org/doc/install"
     7    echo >&2 "You can use scripts/go-wrapper $0 to use go in a docker container."
     8    exit 1
     9  fi
    10  
    11  golinter_path="${GOPATH}/bin/golangci-lint"
    12  
    13  if [[ ! -x "${golinter_path}" ]]; then
    14      go install github.com/golangci/golangci-lint/cmd/golangci-lint@latest
    15  fi
    16  
    17  SOURCE_DIRECTORY=$(dirname "${BASH_SOURCE[0]}")
    18  cd "${SOURCE_DIRECTORY}/.."
    19  
    20  if [[ -n $1 ]]; then
    21      golangci-lint run "$1"
    22  else
    23      golangci-lint run ./...
    24  fi