I prefer to install Go/Golang with Ubuntu 20.04 apt since I do not need the latest up to date version. To install run the commands below.
sudo apt update
sudo apt upgrade -y
sudo apt install -y golang-go
Now create a simple script to check if your Go/Golang was installed successfully. Lets name it “test.go”
package mainimport "fmt"func main() {
fmt.Println("hello world")
}
To run the script.
go run test.go
If you see “hello world” that means you had successfully installed Go/Golang. To check your Go/Golang version use the command below.
go version