mirror of https://github.com/status-im/consul.git
makefile: give better error for tool installed by wrong package (#13797)
I had protoc-gen-go installed through `google.golang.org/protobuf` instead of `github.com/golang/protobuf` and `make proto` was failing silently. This change will ensure you get an error: ``` protoc-gen-go is already installed by module "google.golang.org/protobuf" but should be installed by module "github.com/golang/protobuf". Delete it and re-run to re-install. ```
This commit is contained in:
parent
dc84ea9f85
commit
bb943bc77c
|
@ -188,8 +188,14 @@ function install_versioned_tool {
|
|||
fi
|
||||
|
||||
if command -v "${command}" &>/dev/null ; then
|
||||
got="$(go version -m $(which "${command}") | grep '\bmod\b' | grep "${module}" |
|
||||
awk '{print $2 "@" $3}')"
|
||||
mod_line="$(go version -m "$(which "${command}")" | grep '\smod\s')"
|
||||
act_mod=$(echo "${mod_line}" | awk '{print $2}')
|
||||
if [[ "$module" != "$act_mod" ]]; then
|
||||
err "${command} is already installed by module \"${act_mod}\" but should be installed by module \"${module}\". Delete it and re-run to re-install."
|
||||
return 1
|
||||
fi
|
||||
|
||||
got="$(echo "${mod_line}" | grep "${module}" | awk '{print $2 "@" $3}')"
|
||||
if [[ "$expect" != "$got" ]]; then
|
||||
should_install=1
|
||||
install_reason="upgrade"
|
||||
|
|
Loading…
Reference in New Issue