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