Go is a relatively newer statically typed and compiled programming language that was developed in 2009. A Go program is a combination of functions and methods. This programming language provides a great level of liberty and flexibility to coders and hence it is used quite extensively. Let us take a look at the procedure of installing this language on a Linux machine.
The procedure of Installing Go on Linux Mint 20:
If you want to install Go language on your Linux system, then you should perform the steps described over here on your system.
Step # 1: Perform a System Update:
Before installing Go language on your system, it is good to have an updated system that can be achieved by executing the command shown below:
$ sudo apt-get update
This command will complete its execution with the following output:
Step # 2: Install Go on your System:
Now, you can install Go language on your Linux system with this command:
$ sudo apt-get install golang
During the installation, you need to provide a confirmation with the “y” character and press the Enter key as shown below:
Finally, Go language will be installed on your system and you will be able to verify it as well.
Step # 3: Check the Installed Version of Go on your System:
To confirm which version of Go language has been installed on your Linux system, you can execute the following command:
$ go version
You can see the version of Go language installed on our system in the image below:
Step # 4: Create a Program in Go Language on your System:
To further test your installation of Go language on your system, you can create a program in this language and try to execute it. First, you need to create a file with the “.go” extension by executing this command:
$ sudo nano FileName.go
After creating a Go file, we have created a simple program that prints a sample message on the terminal as shown below. You can save this file by pressing Ctrl+ X.
Step # 5: Run the Go Program you have just created on your System:
Now, it is time to run our Go program with the following command:
$ go run FileName.go
The output of our first Go language program is shown in the image below:
You can also remove the Go language from your Linux system very easily with the following command:
$ sudo apt-get purge --autoremove golang
Soon after running this command, the Go language will be completely removed from your Linux system.
This was a very basic introductory article on the installation of the Go language on a Linux Mint 20 system. Moreover, we also shared with you a very quick method of creating a sample Go program. Finally, we concluded this guide on the removal procedure of Go language from a Linux Mint 20 system.
Karim Buzdar holds a degree in telecommunication engineering and holds several sysadmin certifications including CCNA RS, SCP, and ACE. As an IT engineer and technical author, he writes for various websites.