2
2
#
3
3
# This library holds golang related utility functions.
4
4
5
- # os::golang::verify_go_version ensure the go tool exists and is a viable version.
5
+ # os::golang::verify_go_version ensures the go tool exists and is a viable version.
6
6
function os::golang::verify_go_version() {
7
7
os::util::ensure::system_binary_exists ' go'
8
8
@@ -11,8 +11,7 @@ function os::golang::verify_go_version() {
11
11
if [[ " ${go_version[2]} " < " ${OS_REQUIRED_GO_VERSION} " ]]; then
12
12
os::log::info " Detected go version: ${go_version[*]} ."
13
13
if [[ -z " ${PERMISSIVE_GO:- } " ]]; then
14
- os::log::warning " Please install Go version ${OS_REQUIRED_GO_VERSION} or use PERMISSIVE_GO=y to bypass this check."
15
- return 0
14
+ os::log::fatal " Please install Go version ${OS_REQUIRED_GO_VERSION} or use PERMISSIVE_GO=y to bypass this check."
16
15
else
17
16
os::log::warning " Detected golang version doesn't match required Go version."
18
17
os::log::warning " This version mismatch could lead to differences in execution between this run and the CI systems."
@@ -21,3 +20,17 @@ function os::golang::verify_go_version() {
21
20
fi
22
21
}
23
22
readonly -f os::golang::verify_go_version
23
+
24
+ # os::golang::verify_glide_version ensures the glide is at the required level
25
+ function os::golang::verify_glide_version() {
26
+ os::util::ensure::system_binary_exists ' glide'
27
+
28
+ local glide_version
29
+ glide_version=($( glide --version) )
30
+ if ! echo " ${glide_version[2]# v} " | awk -F. -v min=$OS_GLIDE_MINOR_VERSION ' { exit $2 < min }' ; then
31
+ os::log::info " Detected glide version: ${glide_version[*]} ."
32
+ os::log::fatal " Please install Glide version ${OS_REQUIRED_GLIDE_VERSION} or newer."
33
+ fi
34
+
35
+ }
36
+ readonly -f os::golang::verify_glide_version
0 commit comments