What is Golang and How do we Install it

Atharva Patwardhan
5 min readNov 14, 2019

--

Golang is basically how the language C would be if it (C) was written in Python.

If that confused you, don’t worry. Just hang on till we get to the interesting stuff.

Note:- I am going to use the terms “Golang” and “Go” alternatively further down this article. They both essentially mean the same.

What is Golang

Golang is a programming language that is (like most languages) statically typed and compiled language. What does this mean? This means that unlike interpreted languages like Python (which uses line by line execution via the interpreter), Golang programs are written and compiled as a whole to be able to run them.

If you have prior experience with programming in Python or Java, you’ll know that both Python and Java are not compiled and executed as whole. Java generates a byte-code and in order to run this bytecode, you need something called as the Java Virtual Machine (included in the Java Development Kit). On the other hand, Python isn’t compiled in the classical sense, it is interpreted (by the Python interpreter). This means that Python code is executed line by line, and even though this proves to be fast most of the times, compiled code is faster, because it is basically binary (which is the easiest for computers to understand).

Why Golang

For one, it is easy to learn as compared to Java. Jetbrains conducted a survey among 7000 developers recently which led to the following result:

As you can see above, Go has been called “The most promising programming language”. This is because it has a small set of features which can be used in a lot of ways.

If this doesn’t make sense to you, let’s consider a realistic analogy — The USB. The USB is an interface that is extremely simple, yet its applications are limitless. It is literally EVERYWHERE!

There is also a lot of talk being going on about how Go will be the “future language for the Web”. The statistics project the same.

Golang Installation

Alright. Enough chit-chat, now let’s get to work.

Installing Golang to your machine is relatively easy, but it depends on the Operating System you’re using. Don’t worry if you’re a beginner. This is a step-by-step installation guide, so I’ll be covering all aspects of the installation (including install verification).

Regardless of the OS you are using, you’ll need to go the official Golang download page to download your OS compatible Golang package.

Download Here

You’ll face a screen like this:

Under the section “Featured Downloads, select the package compatible to your Operating System.

For Windows

Microsoft Windows Logo

Step 1: Run the downloaded package.

Step 2: Keep clicking Next till you see a screen specifying the “Destination Folder”.

Here, you can choose the directory/folder in your computer where you want Go to be installed.

Step 3: Once this is done, click Next till the installation starts. After Go has been installed, click on the Finish button.

To check if Go has been installed successfully, just pull up your command line or cmd and type in the command go version

For Linux

I do not own a Linux machine myself, so I will link some good installation guides (ones with screenshots/commands attached) so you don’t have to stress on the OS availability.

Golang Official Documentation

Techmint

For MacOS

Again, I do not own a MacOS/Apple machine myself, so I will link some good installation guides.

Golang Official Documentation

Medium

Baby Steps

That’s it! Go is now successfully installed on your computer! Here are some resources to learn Go:

Traversy Media

Telusko

You can refer any other tutorial you feel comfortable with, but I posted these two because I personally found them comfortable for beginners.

To get started on with Go, open any text/code editor you feel comfortable with, I recommend Sublime Text if you’re a beginner.

Open Sublime Text and type the code as shown in the image:

Note: “fmt” stands for “format”

Save the file on your Desktop with the filename helloWorld.go or any other filename you like. Just make sure to save it with the extension .go”.

Open your command line or cmd and navigate to your Desktop

Enter the command: go run helloWorld.go

The output should appear on your screen as shown in the image below.

Do not panic if it takes a while for the output to be displayed. It’s completely normal.

Hooray! You’ve written your first few lines of Golang code! Take up the tutorials mentioned above to advance through the basics of Golang.

Hope this article helped somewhat informing you about the revolutionary Golang! Happy Coding!

--

--

Atharva Patwardhan
Atharva Patwardhan

Written by Atharva Patwardhan

Software Engineer, Flutter App Developer, Freelancer, Tech Enthusiast

Responses (1)