Go is a popular programming language created by Google. This program is pretty new and it is basically a combination of functions and methods.
Here at Ibmi Media, as part of our Server Management Services, we regularly help our Customers to perform Software Packages Installation tasks.
In this context, we shall look into how to install Go language on a Linux machine.
To perform this Installation procedure, simply follow the steps outlined below.
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 update2. Install Go on your System
Now, you can install Go language on your Linux system with this command:
$ sudo apt-get install golangDuring the installation, you need to provide a confirmation with the "y" character and press the Enter key.
Finally, Go language will be installed on your system and you will be able to verify it as well.
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 versionThis command will display the version of Go language installed on the system.
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.goAfter creating a Go file, create a simple program that prints a sample message on the terminal:
package main
import "fmt"
func main() {
fmt.Println("This is our first Go program")
}Then, You can save this file by pressing Ctrl+ X.
5. Run the recently created Go Program
Now, it is time to run our Go program with the following command:
$ go run FileName.goThe following output will be displayed on the terminal:
This is our first Go programYou can also remove the Go language from your Linux system very easily with the following command:
$ sudo apt-get purge --autoremove golangThis command will remove Go from the system completely.
This article covers the installation procedure of Go language on a Linux Mint 20 system. Also, we dealt with an easy way to remove Go language from a Linux Mint 20 system.
To Verify Go Language Installation, run the command:
$ go version Features of Go Programming