How to install Go Language on Debian 10?

Windows Articles

How to install Sublime Text 3 on Ubuntu 20.04 / Linux Mint 20?

Developing applications requires tools that can facilitate the process. In the web environment, Sublime Text is quite popular for being a very...

How to import or export Local Security Policy in Windows 10/Server 2019

Hello! Microsoft has increased the security of Windows systems with different measures. Indeed, these actions are focused on protecting data and services....

How to install Slack on Ubuntu 20.04?

Hi, folks. In this post you will learn how to install Slack on Ubuntu 20.04. Slack is an application...

How to create a registry backup in Windows Server 2019/2016

Hello! The registry is one of the essential elements within Windows Server. Additionally, the system has an editor to be able to...

How to update apps on Android

Hi folks! In this post, we will show you how to update your Android apps. Updating the apps on your device is...
angeloma
angeloma
Senior Writer and partner

The world of software development is a complex world. Every day new and better features emerge that force developers to broaden their knowledge. However, not all these technologies are complex to assimilate, and for this purpose, I will teach you how to install GO language on Debian 10.

Go is an open-source (BSD license) programming language that was born with the objective of allowing the creation of efficient and easily distributable applications. So, it has binaries for Windows, Mac OS and of course, for Linux.

So, in this post, I will install it and create a “Hello World” file for the test.

Download and install Go Language on Debian 10

Go Language is cross-platform which makes it available for Linux. However, first you have to download the binaries from the project website. But we will use the terminal that is faster and more efficient.

First, make sure you have wget installed on your computer.

:~$ sudo apt install wget

Then proceed to download Go Language. At the time of writing this post, the latest stable version is 1.13.5.

:~$ wget -c https://dl.google.com/go/go1.13.5.linux-amd64.tar.gz -O go.tar.gz
1.- Download and install Go Language on Debian 10
1.- Download and install Go Language on Debian 10

Then, decompress it.

:~$ tar xvf go.tar.gz

Now you have to change the folder permissions. Besides moving it to another location like /usr/local/.

:~$ sudo chown -R root:root go
:~$ sudo mv go /usr/local
2.- Installing Go Language
2.- Installing Go Language

Then, it is necessary to make some modifications to the user’s bash profile in order to use Go. Open the configuration file and add the following:

:~$ sudo nano ~/.profile
export GOROOT=/usr/local/go    
export GOPATH=$HOME/work/
export PATH=$GOPATH/bin:$GOROOT/bin:$PATH
3.- Edit the bash profile
3.- Edit the bash profile

Save the changes (CTRL + O) and close the file (CTRL + X).

With this, Go is ready for work. You can check it by showing the version of the program.

:~$ go version
4.- Go language version
4.- Go language version

Now with a “hello world” we’ll see that everything works.

Testing the installation

As I said before, the best way to test the installation is to run a real code. For this, we will use the typical “Hello World”.

First, we’ll create the directory structure. In our Home, we will create a folder for the project called work. Inside a folder called src where the source code files will go. In it, a folder called hello and inside the file hello.go. Something like this is the directory structure. The folders work and hello can be called differently.

:~$ mkdir -p $HOME/work/src/hello

Now, create the Go file and add the following:

:~$ nano ~/work/src/hello/hello.go
package main 
 import "fmt"
 func main() {
 fmt.Printf("hello, world\n")
 }
5.- Creating a go file
5.- Creating a go file

Again, save the changes and close the file.

:~$ go build hello
:~$ go install hello
:~$ hello
6.- Go language on Debian 10
6.- Go language on Debian 10

So, enjoy it.

Conclusion

GO is a very popular language and every day it is more and more popular. It’s simple but very powerful, besides being open source. As you have seen, its installation is really simple.

More articles

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Latest article

How to install Sublime Text 3 on Ubuntu 20.04 / Linux Mint 20?

Developing applications requires tools that can facilitate the process. In the web environment, Sublime Text is quite popular for being a very...

How to import or export Local Security Policy in Windows 10/Server 2019

Hello! Microsoft has increased the security of Windows systems with different measures. Indeed, these actions are focused on protecting data and services....

How to install Slack on Ubuntu 20.04?

Hi, folks. In this post you will learn how to install Slack on Ubuntu 20.04. Slack is an application...

How to create a registry backup in Windows Server 2019/2016

Hello! The registry is one of the essential elements within Windows Server. Additionally, the system has an editor to be able to...

How to update apps on Android

Hi folks! In this post, we will show you how to update your Android apps. Updating the apps on your device is...
x