Go!

Go! is an agent-based programming language in the tradition of logic-based programming languages like Prolog designed at Google.

Difficulty: Easy

Installation

  • With user admin, go to the temporary folder

cd /tmp
  • Set a temporary version environment variable to the installation

VERSION=1.22.5
  • Set a temporary SHA256 environment variable to the installation

SHA256=904b924d435eaea086515bc63235b192ea441bd8c9b198c507e85009e6e4c7f0
wget https://go.dev/dl/go$VERSION.linux-amd64.tar.gz
  • Check the checksum of the file

echo "$SHA256 go$VERSION.linux-amd64.tar.gz" | sha256sum --check

Example of expected output:

> go1.21.10.linux-amd64.tar.gz: OK
  • Extract and install Go in the /usr/local directory

sudo tar -C /usr/local -xvzf go$VERSION.linux-amd64.tar.gz
  • Add the next line at the end of the /etc/profile file

echo 'export PATH=$PATH:/usr/local/go/bin' | sudo tee -a /etc/profile

Expected output:

export PATH=$PATH:/usr/local/go/bin
  • Apply the changes immediately to the current session

source /etc/profile
  • Verify that you've installed Go by typing the following command

go version

Example of expected output:

> go version go1.21.10 linux/amd64
  • (Optional) Delete the file of the temporary folder to be immediately ready for the next update

rm go$VERSION.linux-amd64.tar.gz

Upgrade

  • With user admin, remove any previous Go installation

sudo rm -rf /usr/local/go
  • Go to the temporary folder

cd /tmp
  • Set a temporary version environment variable with the new value, to the installation

VERSION=1.22.3
  • Set the new temporary SHA256 environment variable to the installation

SHA256=8920ea521bad8f6b7bc377b4824982e011c19af27df88a815e3586ea895f1b36
wget https://go.dev/dl/go$VERSION.linux-amd64.tar.gz
  • Check the checksum of the file

echo "$SHA256 go$VERSION.linux-amd64.tar.gz" | sha256sum --check

Example of expected output:

> go1.22.3.linux-amd64.tar.gz: OK
  • Extract and install Go in the /usr/local directory

sudo tar -C /usr/local -xvzf go$VERSION.linux-amd64.tar.gz
  • Verify that you've updated Go by typing the following command

go version

Example of expected output:

go version go1.22.3 linux/amd64
  • (Optional) Delete the file of the temporary folder to be immediately ready for the next update

rm go$VERSION.linux-amd64.tar.gz

Uninstall

  • Delete go folder

sudo rm -rf /usr/local/go
  • Edit /etc/profile file and delete the complete export PATH=$PATH:/usr/local/go/bin line at the end of the file. Save and exit

sudo nano /etc/profile
  • Apply the changes immediately to the current session

source /etc/profile
  • Ensure you are uninstalled Go definitely

go version

Expected output:

> -bash: /usr/local/go/bin/go: No such file or directory

Next new session you will obtain this command when you try go version command:

Command 'go' not found..

Last updated