Skip to content

Commit

Permalink
Allow newer versions of Go than we require in dev.sh (#3681)
Browse files Browse the repository at this point in the history
This should be safe given Go's compatability guarantees and it makes
using ASO easier with dev.sh and other Go projects which may have moved
to a newer Go version before we did easier.
  • Loading branch information
matthchr committed Jan 4, 2024
1 parent 5bac6d1 commit 517d028
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions .devcontainer/install-dependencies.sh
Original file line number Diff line number Diff line change
Expand Up @@ -103,10 +103,21 @@ fi
GOVER=$(go version)
write-info "Go version: ${GOVER[*]}"

GOVERREGEX=".*go1.([0-9]+).([0-9]+).*"
GOVERREQUIRED="go1.20.*"
GOVERACTUAL=$(go version | { read _ _ ver _; echo "$ver"; })
if ! [[ "$GOVERACTUAL" =~ $GOVERREQUIRED ]]; then
write-error "Go must be version $GOVERREQUIRED, not $GOVERACTUAL; see : https://golang.org/doc/install"

if ! [[ $GOVERACTUAL =~ $GOVERREGEX ]]; then
write-error "Unexpected Go version format: $GOVERACTUAL"
exit 1
fi

GOMINORVER="${BASH_REMATCH[1]}"
GOMINORREQUIRED=20

# We allow for Go versions above the min version, but prevent versions below. This is safe given Go's back-compat guarantees
if ! [[ $GOMINORVER -ge $GOMINORREQUIRED ]]; then
write-error "Go must be version 1.$GOMINORREQUIRED, not $GOVERACTUAL; see : https://golang.org/doc/install"
exit 1
fi

Expand Down

0 comments on commit 517d028

Please sign in to comment.