~whereswaldon/gover

a46f7fd41704ec071d472d73cb1084bcf5baefd8 — Chris Waldon 5 months ago b0f1dd8
feat: fix version fallback to zero better
1 files changed, 6 insertions(+), 3 deletions(-)

M gover
M gover => gover +6 -3
@@ 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