DEV Community

Cover image for Introduction and Installation
Neeraj Kumar
Neeraj Kumar

Posted on

Introduction and Installation

#go

What is golang ?
Golang (Go) is a statically and compiled language created by google.
Go is mostly used to develop highly scalable and fast web apps.

Benefits of using go for your rest api

There are so many programming languages to choose from when you want to make a rest api.Python(flask),node or even java. However go has some benefits which makes it a good choice whenever you are making a rest api.

some of the benefits of using go:

  1. Quick compilation and execution speed.

  2. its very easy and fast to learn -go has a very simple
    syntax.This makes it very easy to learn.

  3. Lightweight goroutines that support concurrency.

  4. Extensive and very well documented built-in libraries.

Why learn Golang?
Now you still might be asking why should I learn Golang with all the other alternatives out there.
list of some of the pros of the Go programming language:

Simple syntax - Go has concise and straightforward syntax that makes writing readable and maintainable code easy.
Compiled language
Static linking - The compiler supports static linking which means you can statically link your project into one massive binary and then simply deploy it to the cloud or a server.
Open source - Go is open-source so you can read the source code and contribute to the repository.

Installing / Updating Go
If you’re updating a previously installed Go version, you must first delete the older one:

sudo rm -r /usr/local/go
Download the latest version of Go archive from https://golang.org/dl/ and extract it:

sudo tar -C /usr/local -xzf go1.7.1.linux-amd64.tar.gz
Note: some people use the Go version manager (GVM) to install and set up Go, a tool similar to NVM which I highly recommend for Node.js, but for Go I prefer to set up everything myself.

Next, set the PATH environment variables by adding the following to .bashrc:

export PATH=$PATH:/usr/local/go/bin
export GOPATH=$HOME/go

Here I use home/neeraj/go as my workspace (which is $HOME/go), but feel free to change it according to your preference.

And, create your workspace:

mkdir -p ~/go/src/github.com/neeraj

Golang Study Point

Go language

Top comments (0)