@@ 16,13 16,16 @@ GOOS=$(current_os)
GOARCH=amd64 # TODO: find a portable way to determine this without go installed
major() {
- echo "$1" | cut -d. -f1
+ out=$(echo "$1" | cut -d. -f1)
+ if [ -z "$out" ]; then echo 0; else echo "$out"; fi
}
minor() {
- echo "$1" | cut -d. -f2 || echo 0
+ out=$(echo "$1" | cut -d. -f2)
+ if [ -z "$out" ]; then echo 0; else echo "$out"; fi
}
patch() {
- echo "$1" | cut -d. -f3 || echo 0
+ out=$(echo "$1" | cut -d. -f3)
+ if [ -z "$out" ]; then echo 0; else echo "$out"; fi
}
# version_dir emits the directory into which a particular go