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.

Vulkan for Linux Users
With each new generation of graphics cards, we see game developers push the limits of graphical fidelity and come one step closer to photorealism. But...
OpenTTD vs Simutrans
Creating your own transport simulation can be fun, relaxing and extremely enticing. That's why you need to make sure that you try out as many games as...
OpenTTD Tutorial
OpenTTD is one of the most popular business simulation games out there. In this game, you need to create a wonderful transportation business. However,...