#!/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/packages@v0.16.0 if [ ! -f "${GOBIN}/mockgen" ]; then echo "mockgen was not found, installing..." go get github.com/golang/mock/gomock@v1.6.0 go get github.com/golang/mock/mockgen@v1.6.0 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/goimports@v0.16.0 fi