Thursday, 27 October 2016

GO

By,
Parikshit

Go language stands for Golang is open source and free language.  The language is developed in 
2007 by Robert Griesemer, Rob Pike, and Ken Thompson.  The language mainly have features like limited structural typing and concurrent programming with addition to this memory safety is provided.
The language was shown in November 2009 used for Google’s its own production unit. The language is mainly divided in two types  Google’s Go compiler, “gc” and is kept as open source software and can be used on various platforms like Linux,  Windows and also used on mobile devices. The second type gccgo, is used as GCC for front end purpose.

Design:
GO is based on programming language C. It is having many changes regarding conciseness, simplicity and safety.  Go consists of loosely coupled language. Means we does not require to declare a variable type separately.  Also it is having fast compilation time. It is having  built in concurrency primitive. Have an interface system instead of virtual inheritance. A separate toolchain is provided  with statically linked native binaries  except external dependencies.

System Level Programming:
Go language can interact with native system functions, which is not good for creating extremely low level system parameters like device drivers or kernels. GO applications are dependent on underlying OS. 

How to use GO:
Go can be downloaded from its website. Also there are different packages available with for different platforms like Linux,  Windows, MacOS.  As GO is open source language it can be accessed freely.  Also its packages vary  according to architechture also as ARM, x64, x86
Go language Introduction:
Go language is based on C and C++. So its syntax is similar to C. Following are some functions explained below:
1) If condition
2) For loop
3) Switch
The above functionality is also available in GO language having similar syntax like C language.
e.g.  
for (i=0;i<10;i++)
{
    sum+=sum
}

for{
 syntax
}

e.g. 
t:=time.Now()
{
switch
{
case t.Hour()<12:
fmt.Println(“Your text”)
default:
fmt.Println(“Your text”)
}
}

Data types:
GO contains data types similar to C which are listed below
1. Boolean : Contains Boolean value
2. Numeric:  uint64, int8 to int64, float64 etc.
3. String: Contains string values
4. Struct: Contains struct values
5. Pointer: Used with *
6. Function: used with keyword func
7. Interface: used as interface
8. Channel: used as channel

Array: 
The GO language provides facility to store multiple records with same datatype using an array. It is generally one dimensional but can be used as multi dimensional.

Slice:
Slice is additional functionality provided with GO language. It represents segment of an array. It is similar to an array and is single dimensional.
e.g. make([]int,50,100)
 
Advantage of GO:
Large programmes can be simplified with help of GO language and simply called as Server Software.