File tree Expand file tree Collapse file tree 1 file changed +12
-2
lines changed Expand file tree Collapse file tree 1 file changed +12
-2
lines changed Original file line number Diff line number Diff line change @@ -67,19 +67,29 @@ Provide the binary and try running $0 again."
67
67
readonly -f os::util::ensure::built_binary_exists
68
68
69
69
# os::util::ensure::gopath_binary_exists ensures that the
70
- # given binary exists on the system in $GOPATH.
70
+ # given binary exists on the system in $GOPATH. If it
71
+ # doesn't, we will attempt to build it if we can determine
72
+ # the correct install path for the binary.
71
73
#
72
74
# Globals:
73
75
# - GOPATH
74
76
# Arguments:
75
77
# - 1: binary to search for
78
+ # - 2: [optional] path to install from
76
79
# Returns:
77
80
# None
78
81
function os::util::ensure::gopath_binary_exists() {
79
82
local binary=" $1 "
83
+ local install_path=" ${2:- } "
80
84
81
85
if ! os::util::find::gopath_binary " ${binary} " > /dev/null 2>&1 ; then
82
- os::log::fatal " Required \` ${binary} \` binary was not found in \$ GOPATH."
86
+ if [[ -n " ${install_path:- } " ]]; then
87
+ os::log::info " No installed \` ${binary} \` was found in \$ GOPATH. Attempting to install using:
88
+ $ go get ${install_path} "
89
+ go get " ${install_path} "
90
+ else
91
+ os::log::fatal " Required \` ${binary} \` binary was not found in \$ GOPATH."
92
+ fi
83
93
fi
84
94
}
85
95
readonly -f os::util::ensure::gopath_binary_exists
You can’t perform that action at this time.
0 commit comments