Skip to content

Latest commit

 

History

History
208 lines (141 loc) · 3.68 KB

go.md

File metadata and controls

208 lines (141 loc) · 3.68 KB
layout
title description tableOfContents outline pagination
visible
true
visible
visible
true
visible
true
visible
true

Go!

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

{% hint style="success" %} Difficulty: Easy {% endhint %}

Installation

  • With user admin, go to the temporary folder
cd /tmp
  • Set a temporary version environment variable to the installation
VERSION=1.23.2
  • Set a temporary SHA256 environment variable to the installation
SHA256=542d3c1705f1c6a1c5a80d5dc62e2e45171af291e755d591c5e6531ef63b454e
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 -xzvf 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.23.2
  • Set the new temporary SHA256 environment variable to the installation
SHA256=542d3c1705f1c6a1c5a80d5dc62e2e45171af291e755d591c5e6531ef63b454e
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 -xzvf 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..