Skip to content

Commit bd47153

Browse files
authored
fix: update floor version, tinygo version check (#35)
* fix: update floor version, tinygo version check * check for lt, and error if true (must be >=) Signed-off-by: Edoardo Vacchi <evacchi@users.noreply.github.com>
1 parent 1bf9268 commit bd47153

1 file changed

Lines changed: 10 additions & 10 deletions

File tree

template/prepare.sh

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -6,17 +6,17 @@ command_exists () {
66
command -v "$1" >/dev/null 2>&1
77
}
88

9-
# Function to compare version numbers
10-
version_gt() {
11-
test "$(echo "$@" | tr " " "\n" | sort -V | head -n 1)" != "$1"
9+
# Function to compare version numbers for "less than"
10+
version_lt() {
11+
test "$(echo "$@" | tr " " "\n" | sort -V | head -n 1)" = "$1" && test "$1" != "$2"
1212
}
1313

1414
missing_deps=0
1515

1616
# Check for Go
1717
if ! (command_exists go); then
1818
missing_deps=1
19-
echo "❌ Go (supported version between 1.18 - 1.23) is not installed."
19+
echo "❌ Go (supported version between 1.20 - 1.24) is not installed."
2020
echo ""
2121
echo "To install Go, visit the official download page:"
2222
echo "👉 https://go.dev/dl/"
@@ -37,17 +37,17 @@ if ! (command_exists go); then
3737
echo ""
3838
fi
3939

40-
# Check for the right version of Go, needed by TinyGo (supports go 1.18 - 1.23)
40+
# Check for the right version of Go, needed by TinyGo (supports go 1.20 - 1.24)
4141
if (command_exists go); then
4242
compat=0
43-
for v in `seq 18 23`; do
43+
for v in `seq 20 24`; do
4444
if (go version | grep -q "go1.$v"); then
4545
compat=1
4646
fi
4747
done
4848

4949
if [ $compat -eq 0 ]; then
50-
echo "❌ Supported Go version is not installed. Must be Go 1.18 - 1.23."
50+
echo "❌ Supported Go version is not installed. Must be Go 1.20 - 1.24."
5151
echo ""
5252
fi
5353
fi
@@ -81,12 +81,12 @@ if ! (command_exists tinygo); then
8181
else
8282
# Check TinyGo version
8383
tinygo_version=$(tinygo version | grep -o '[0-9]\+\.[0-9]\+\.[0-9]\+' | head -n1)
84-
if ! version_gt "$tinygo_version" "0.34.0"; then
84+
if version_lt "$tinygo_version" "0.34.0"; then
8585
missing_deps=1
86-
echo "❌ TinyGo version must be greater than 0.34.0 (current version: $tinygo_version)"
86+
echo "❌ TinyGo version must be >= 0.34.0 (current version: $tinygo_version)"
8787
echo "Please update TinyGo to a newer version."
8888
echo ""
8989
fi
9090
fi
9191

92-
go install golang.org/x/tools/cmd/goimports@latest
92+
go install golang.org/x/tools/cmd/goimports@latest

0 commit comments

Comments
 (0)