Google Golang for Beginners

Computer programming is the art, craft and science of writing programs which define how computers operate.So in this post i will show you how to start programming with Golang (by google).Go is a general purpose programming language with advanced features and a clean syntax. Because of its wide availability on a variety of platforms, its robust well documented common library, and its focus on good software engineering principles, Go is an ideal language to learn as your first programming language.

Go lang :

Features of language Go :

Interfaces to replace virtual inheritance.
Syntax and environment adopting patterns.
Compiled into statically linked native binaries without external dependencies.
Remote package management.
Online package documentation.
Built-in concurrency primitives.
Large built-in library.
Type embedding to replace non-virtual inheritance.
Simple language specifications.
Fast compilation time.
Light testing framework.

How to install go lang in ubuntu : 

Step 1 : Open your terminal

curl -O

Next, you can use sha256sum to verify the tarball:

sha256sum go1.6.linux-amd64.tar.gz

Step 2 : Extract the tar.

tar xvf go1.6.linux-amd64.tar.gz

Step 3 : Permission change for go.

sudo chown -R root:root ./go
sudo mv go /usr/local

Step 4 : Set Go's root value which tells go where to look for its files.

sudo nano ~/.profile

Add these lines at the end of file

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

After save the file close the file and refresh your profile by using command .

source ~/.profile

Step 5 : Create a simple hello program for go.

nano ~/work/src/hello.go

import the package for go 

package main

import "fmt"

func main() {
    fmt.Printf("hello world for go\n")

Save and close the file then compile it by invoking the Go command install:

go install ~/work/src/hello

With the file compiled you can run it by simply executing the command:


if this will return hello world for go , that means successfully installed the lang go. This is just the begining steps to install go lang . I hope you enjoy the post please share and comment.

No comments:

Post a Comment

Download the eBook of react js for beginners

ReactJS basically is an open-source JavaScript library which is used for building user interfaces specifically for single page applications...