Difference between revisions of "Go install"
Jump to navigation
Jump to search
| Line 2: | Line 2: | ||
https://golang.org/doc/install | https://golang.org/doc/install | ||
``` | ``` | ||
| − | sudo apt remove -y golang-go | + | #!/bin/bash |
| − | curl -LO https:// | + | set -eu |
| − | sudo rm -rf /usr/local/go && sudo tar -C /usr/local -xzf | + | version=1.20.3 |
| − | echo | + | sudo apt remove -y golang-go || true |
| + | # curl -LO https://go.dev/dl/go1.20.3.linux-amd64.tar.gz | ||
| + | curl -LO https://golang.org/dl/go$version.linux-amd64.tar.gz | ||
| + | sudo rm -rf /usr/local/go && sudo tar -C /usr/local -xzf go$version.linux-amd64.tar.gz | ||
| + | echo 'export PATH=${PATH}:/usr/local/go/bin' >> ~/.bashrc | ||
. ~/.bashrc | . ~/.bashrc | ||
``` | ``` | ||
Revision as of 20:08, 22 April 2023
https://golang.org/doc/install
#!/bin/bash
set -eu
version=1.20.3
sudo apt remove -y golang-go || true
# curl -LO https://go.dev/dl/go1.20.3.linux-amd64.tar.gz
curl -LO https://golang.org/dl/go$version.linux-amd64.tar.gz
sudo rm -rf /usr/local/go && sudo tar -C /usr/local -xzf go$version.linux-amd64.tar.gz
echo 'export PATH=${PATH}:/usr/local/go/bin' >> ~/.bashrc
. ~/.bashrc
Snap
sudo snap install --classic go
Apt
sudo apt install -y golang-go