Fixed new go fetch version with time

This commit is contained in:
Sambo Chea 2023-08-14 10:18:32 +07:00
parent 97d9f692e2
commit e43e310aab

View File

@ -16,13 +16,17 @@ ROOT_GO_PATH=$(echo $BASE_GO_PATH | sed 's/\/go//g')
# echo "Current Go path: $CURRENT_GO_PATH | Base Go path: $BASE_GO_PATH | Root Go path: $ROOT_GO_PATH"
#UPDATE_GO_VERSION=${1:-}
FETCH_FROM_GO_VERSION=$(curl -s https://go.dev/VERSION?m=text)
echo "Latest fetched from: https://go.dev/VERSION => $FETCH_FROM_GO_VERSION"
FETCH_FROM_GO_VERSION=$(curl -s https://go.dev/VERSION?m=text | awk 'NR==1 {sub(/^go/, ""); print}')
# Output:
# go1.21.0
# time 2023-08-04T20:14:06Z
UPDATE_GO_VERSION=$(echo $FETCH_FROM_GO_VERSION)
echo "Latest fetched from: https://go.dev/VERSION => $UPDATE_GO_VERSION"
UPDATE_GO_VERSION=$(echo $FETCH_FROM_GO_VERSION | sed 's/^go//')
# UPDATE_GO_VERSION=$(echo $FETCH_FROM_GO_VERSION | sed 's/^go//')
if [ -z "$UPDATE_GO_VERSION" ]; then
echo "Usage: $0 <go-version> | Example: $0 1.19.5"
echo "Usage: $0 <go-version> | Example: $0 1.20.0"
exit 1
fi