38 lines
855 B
Bash
38 lines
855 B
Bash
#!/usr/bin/env bash
|
|||
|
|
|
||
|
|
set -o errexit
|
||
|
|
set -o nounset
|
||
|
|
|
||
|
|
test -z "${DEBUG:-}" || {
|
||
|
|
set -x
|
||
|
|
}
|
||
|
|
|
||
|
|
tools=$(pwd)/_tools
|
||
|
|
export GOBIN="${tools}/bin"
|
||
|
|
export GO111MODULE=on
|
||
|
|
|
||
|
|
mkdir -p "${GOBIN}"
|
||
|
|
cd "${tools}"
|
||
|
|
|
||
|
|
if [ ! -f go.mod ]; then
|
||
|
|
go mod init tools
|
||
|
|
fi
|
||
|
|
|
||
go get golang.org/x/tools/go/[email protected]
|
|||
|
|||
|
|
if [ ! -f "${GOBIN}/mockgen" ]; then
|
||
|
|
echo "mockgen was not found, installing..."
|
||
go get github.com/golang/mock/[email protected]
|
|||
|
|
go get github.com/golang/mock/[email protected]
|
||
fi
|
|||
|
|
|
||
|
|
if [ ! -f "${GOBIN}/golangci-lint" ]; then
|
||
|
|
echo "golangci was not found, installing..."
|
||
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin v1.55.2
|
|||
fi
|
|||
|
|
|
||
|
|
if [ ! -f "${GOBIN}/goimports" ]; then
|
||
|
|
echo "goimports was not found, installing..."
|
||
go get golang.org/x/tools/cmd/[email protected]
|
|||
fi
|