如何下载Go的最新版本

wil*_*mdh 2 bash shell automation go

如何在不知道最新版本的确切版本号的情况下找到Go的最新版本号?这是为了构建下载URL.

当发布在GitHub上时,我可以使用例如

curl -s "https://api.github.com/repos/nagios-plugins/nagios-plugins/releases/latest" | jq -r '.assets[] | .browser_download_url')
Run Code Online (Sandbox Code Playgroud)

但由于下载网址不在GitHub上,而是在https://golang.org/dl/上,我很想知道如何找到最新的Go版本号.

mh-*_*bon 5

从ml得到了这个,

# setup go
VERSION=`curl https://golang.org/VERSION?m=text`
wget https://storage.googleapis.com/golang/$VERSION.windows-amd64.msi
Run Code Online (Sandbox Code Playgroud)