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.

Parhaat pelit, joita voi seurata käsien seurannalla
Oculus Quest esitteli äskettäin loistavan ajatuksen seurannasta ilman ohjaimia. Yhä kasvavan määrän pelejä ja aktiviteetteja, jotka tukevat tukea joko...
Kuinka näyttää OSD-peitto koko näytön Linux-sovelluksissa ja peleissä
Koko näytön pelien pelaaminen tai sovellusten käyttäminen häiriöttömässä koko näytön tilassa voi estää sinut paneelissa tai tehtäväpalkissa näkyvistä ...
Viisi parasta pelin kaappauskorttia
Olemme kaikki nähneet ja rakastaneet suoratoistopelejä YouTubessa. PewDiePie, Jakesepticye ja Markiplier ovat vain joitain huippupelaajista, jotka ova...