Let’s Go ~ A Complete Guide (Part ~ II)

Himanshu Singh
MindOrks
Published in
3 min readAug 9, 2018

This is second part of the series Let’s Go ~ A Complete Guide.If you have not followed the Part ~ I , I would request you to go and get an idea why should we learn GoLang.Following is the content of the Series,

  1. Introduction to Go
  2. Go Environment Setup
  3. Go Basics
  4. Control Statement and Functions
  5. Structs
  6. Object Oriented Programming in Go
  7. Concurrency

Go Installation : —

The most popular ways to install Go Lang in your local machine are ,

Using Official Documentation :~

MacBooks :

Go to the download page, choose go(latest-version).pkg. Going all the way to the end by clicking “next”, ~/go/bin will be added to your system’s $PATH after you finish the installation. Now open the terminal and type go . You should see the same output shown below.

After running the command in Terminal.

Linux :

Go to the download page, choose go(latest-version).tar.gz for based on the bits(32,64). Suppose you want to install Go in the $GO_INSTALL_DIR path. Uncompress the tar.gz to your chosen path using the command tar zxvf go(latest-version).tar.gz -C $GO_INSTALL_DIR . Then set your $PATH with the following: export PATH=$PATH:$GO_INSTALL_DIR/go/bin . Now just open the terminal and type go . You should now see the same output as above.

Windows :

Go to the download page, choose go(latest-version).windows-386.msi for 32-bit systems and go(latest-version).windows-amd64.msi for 64-bit systems. Going all the way to the end by clicking “next”, c:/go/bin will be added to path . Now just open a command line window and type go . You should now see the same output as above

Using Third Party Tools :~

GVM

GVM is a Go multi-version control tool developed by a third-party, like rvm for ruby. It’s quite easy to use. Install gvm by typing the following commands in your terminal:

bash < <(curl -s -S -L https://raw.github.com/moovweb/gvm/master/binscripts/gvm-installer)

Then we install Go using the following commands:

gvm install go(latest-version)
gvm use go(latest-version)

apt-get

Ubuntu is the most popular desktop release version of Linux. It uses apt-get to manage packages. We can install Go using the following commands.

sudo add-apt-repository ppa:gophers/go 
sudo apt-get update
sudo apt-get install golang-go

Starting from go 1.8, The GOPATH environment variable now has a default value if it is unset. It defaults to $HOME/go on Unix and %USERPROFILE%/go on Windows.

HomeBrew

Homebrew is a software management tool commonly used in Mac to manage packages. Just type the following commands to install Go.

  1. Install Homebrew
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

2. Install Go

brew update && brew upgrade 
brew install go

Let’s Start :~

As a programmer to start off with anything we do a hello world program.The following is the implementation of a hello world program in Go.

IDEs Supported :~

These are the comprehensive list of IDEs and Code Editor available to use for GoLang. But my personal favourites are VSCode, IntelliJIDE, GoLand(Paid)

PS : Lets gets our hands dirty with some Go Basics(Part~III)

If you are liking this series, add 👏 and show some love. 💌

Follow me on Facebook, Twitter, Instagram 😃

--

--