Merge pull request #12437 from cfc4n/down_gobin_noexist

scripts: install github.com/myitcv/gobin while gobin doesn't exist.
This commit is contained in:
Jingyi Hu 2020-11-03 23:23:14 +08:00 committed by GitHub
commit 8c3c398676
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 4 deletions

View File

@ -17,8 +17,6 @@ if [[ $(protoc --version | cut -f2 -d' ') != "3.12.3" ]]; then
exit 255
fi
run env GO111MODULE=off go get -u github.com/myitcv/gobin
GOFAST_BIN=$(tool_get_bin github.com/gogo/protobuf/protoc-gen-gofast)
GRPC_GATEWAY_BIN=$(tool_get_bin github.com/grpc-ecosystem/grpc-gateway/protoc-gen-grpc-gateway)
SWAGGER_BIN=$(tool_get_bin github.com/grpc-ecosystem/grpc-gateway/protoc-gen-swagger)

View File

@ -278,6 +278,11 @@ function tool_exists {
fi
}
# Ensure gobin is available, as it runs majority of the tools
if ! command -v "gobin" >/dev/null; then
run env GO111MODULE=off go get github.com/myitcv/gobin || exit 1
fi
# tool_get_bin [tool] - returns absolute path to a tool binary (or returns error)
function tool_get_bin {
tool_exists "gobin" "GO111MODULE=off go get github.com/myitcv/gobin" || return 2
@ -308,5 +313,3 @@ function run_go_tool {
run "${cmdbin}" "$@" || return 2
}
# Ensure gobin is available, as it runs majority of the tools
run env GO111MODULE=off go get github.com/myitcv/gobin