File tree Expand file tree Collapse file tree 2 files changed +25
-8
lines changed
Expand file tree Collapse file tree 2 files changed +25
-8
lines changed Original file line number Diff line number Diff line change @@ -52,6 +52,28 @@ case "$arch" in
5252 ;;
5353esac
5454
55+ show_version () {
56+ msg version $version
57+ }
58+
59+ show_version
60+
61+ find_latest () {
62+ local last=
63+ local fetch=
64+ if hash wget 2> /dev/null; then
65+ fetch=" wget -qO-"
66+ else
67+ fetch=" curl --silent"
68+ fi
69+ last=$( $fetch https://golang.org/doc/devel/release.html | grep -E -o ' go[0-9\.]+' | grep -E -o ' [0-9]\.[0-9]+(\.[0-9]+)?' | sort | uniq | tail -1)
70+ if echo " $last " | grep -q -E ' [0-9]\.[0-9]+(\.[0-9]+)?' ; then
71+ msg find_latest: found last release: " $last "
72+ release=$last
73+ fi
74+ }
75+ find_latest
76+
5577[ -n " $SOURCE " ] && source=$SOURCE
5678[ -n " $DESTINATION " ] && destination=$DESTINATION
5779[ -n " $RELEASE " ] && release=$RELEASE
@@ -311,10 +333,6 @@ remove_old_install() {
311333 fi
312334}
313335
314- show_version () {
315- msg version $version
316- }
317-
318336check_package () {
319337 if hash dpkg 2> /dev/null && dpkg -s golang-go 2> /dev/null | grep ^Status | grep -q installed; then
320338 msg warning: golang-go is installed, you should remove it: sudo apt remove golang-go
@@ -348,14 +366,13 @@ case "$1" in
348366 ;;
349367esac
350368
351- show_version
352369show_vars | log_stdin
353370check_package
354371
355- msg will install golang " $label " as: " $abs_goroot "
356-
357372cd " $destination " || die could not enter destination=" $destination "
358373
374+ msg will install golang " $label " as: " $abs_goroot "
375+
359376download
360377remove_old_link
361378untar
Original file line number Diff line number Diff line change 1- 51e6a830828f12f089a21cdc45ab2eee5dc4d1cb73feb64aa75d9d0ad145b9ba update-golang.sh
1+ e24ce7e0d2eda19dce857f5f2a9d54dba6b9cd156c27ea8d4a5817f437675b6c update-golang.sh
You can’t perform that action at this time.
0 commit comments