Steps to Install go-lang

As day by day, our technologies are becoming challenging, to solve that a lot of programming language is refreshing in vast majorities. Most of the developer keep looking for new languages which must fast, safe and easy to work with. Go lang is one of new programing language come under this list. from the past 2 years, it’s gaining a lot of popularity due its supersonic compilation speed,easyly maintaiene of the code

Go is an open source programming language that makes it easy to build simple, reliable, and efficient software. Go was designed at Google in 2007 to improve programming productivity.

Go has some unique primitives in the language to support concurrency which has become important with the switch to multicore devices. Go comes with a robust ORM library called GORM. The library provides all the essential elements required to build a great application.

Installing go for mac

Firstly go to https://golang.org/ download the go install file and Install the go.

once the installation is done. open the terminal and verify the go by using the below cmd in your terminal to check which go version your using.

go version

Setup the workspace:

Go has a different approach of managing code and you have to manage all the go programming in single directory. So we need to setup the workspace to go lang to support.

GO a code will need to live in a file somewhere. Most programming languages don’t care where this exists on your computer. Go has the concept of a “Workspace”; a directory where all of your Go code should live.

open the terminal and create go workspace folder


mkdir /Users/username/go_workspace
mkdir /Users/username/go_workspace/src/
mkdir /Users/username/go_workspace/pkg/
mkdir /Users/username/go_workspace/bin/

src : folder which contain all the go source code.
pkg : folder which contain all the go pakage.
bin : folder which contain all the gi compiled binaries

Setting the Environment variable.

open the terminal and create bash_profile and add the below cmd and save the .bash_profile


vim .bash_profile (Dont copy this line inside your .bash_profile,)
export GOROOT=/usr/local/go/
export GOPATH=/Users/Username/go_workspace 
GOPATH is the root of the workspace where it will /User/username/go_workpace.

GOROOT is the location of your Go installation.

Installing go for Windows

Installing go into your windows is similar to which I have mentioned above.

Download GO for windows from https://golang.org/doc/install


After the installing go Ensure
the Go binaries (found in 
C:\Go\bin) are in your 
Path system
environment variables. To check click 
SystemAdvanced system settingsEnvironment Variables... and open Path under System variables

Setting up Go workspace in Windows

Step 1 : Create the folder name go_workspace in your C drive c:/go_workspace

Step 2: You will have to create 3 folders like above mention src, pkg, bin inside your go_workspace directory.

Setting up go Environment variable

For Windows 10 just go to search bar—>type env–>select environment variables—>click New –>and in variable name textbox enter name has GOPATH–> in variable value textbox give your go_workspace directory path c:/go_wokspace . As show in below image.

Your all set to go and do some coding !!!!!!!!

Now it’s time to run some go code. It’s easy, Just open terminal and type below code.


go get github.com/golang/example/hello $GOPATH/bin/hello(for mac user) %GOPATH%/bin/hello(for windows user)

Have fun with go!!!! and hope this will help, please leave comment.

Leave a Reply

Your email address will not be published. Required fields are marked *