Ubuntu

How to Install Go on Ubuntu 20.04

How to Install Go on Ubuntu 20.04

Go, or we can call it Golang, an open-source programming language created by Google in 2007 and publicly announced in November 2009. This procedural language allows users to build dependable, reliable, and efficient applications. Many well-known organizations prefer to Go programming languages such as Mangodb, Soundcloud, Netflix, Uber, etc.

Multiple advantages can be listed to show why Go should be preferred to be used. For instance, it is used for advanced performance in Networking, standard library, testing, static typing with level efficiency. More importantly, it supports lightweight processes that behave like threads and enable concurrent processing.

Install Go on Ubuntu 20.04 (LTS) and 20.10:

To get “Go”, use the command given below in the terminal:

$ sudo apt install golang

Downloading and installation will be completed within few seconds.

To verify, use the following command:

$ go version

As it can be seen that it is installed, and output is showing a version of Go. Let's get started with Go language to test its working:

Getting started with Go:

Firstly, create a workspace directory named “go”:

$ mkdir ~/go

Then, inside the workspace, create a subdirectory “src” :

$ mkdir -p ~/go/src/

Once your directory is created, make a new file named “hello.go” and write a program to print “Hello World” in the terminal:

To get the output of this program, type:

$ go run hello.go

Another aspect of Golang is that you can also build executable files from source code.

To run the hello.go file, use:

$ go build hello.go

Now, run that executable file:

$ ./hello

Conclusion:

In this guide, we have installed Go on Ubuntu and also checked its example as well. Go is a procedural language developed by Google, and many applications like Terraform, Docker, are using this language.

How to change Left & Right mouse buttons on Windows 10 PC
It's quite a norm that all computer mouse devices are ergonomically designed for right-handed users. But there are mouse devices available which are s...
Emulate Mouse clicks by hovering using Clickless Mouse in Windows 10
Using a mouse or keyboard in the wrong posture of excessive usage can result in a lot of health issues, including strain, carpal tunnel syndrome, and ...
Add Mouse gestures to Windows 10 using these free tools
In recent years computers and operating systems have greatly evolved. There was a time when users had to use commands to navigate through file manager...