Difference between revisions of "Go install"

From UVOO Tech Wiki
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://golang.org/dl/go1.16.6.linux-amd64.tar.gz
+
set -eu
sudo rm -rf /usr/local/go && sudo tar -C /usr/local -xzf go1.16.6.linux-amd64.tar.gz
+
version=1.20.3
echo "export PATH=$PATH:/usr/local/go/bin" >> ~/.bashrc
+
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