GO programming language

Go is a procedural programming language. It was developed in 2007 by Robert Griesemer, Rob Pike, and Ken Thompson at Google but launched in 2009 as an open-source programming language. Programs are assembled by using packages, for efficient management of dependencies. This language also supports environment adopting patterns alike to dynamic languages. For eg., type inference (y := 0 is a valid declaration of a variable y of type float)

There are various online IDEs such as The Go Playground, repl.it, etc. which can be used to run Go programs without installing.
For installing Go in own PCs or Laptop we need of following two software: Text editor and Compiler
Text Editor: Text editor gives you a platform where you write your source code. Following are the list of text editors:
Windows notepad
OS Edit commandFinding a Go Compiler: Go distribution comes as a binary installable for FreeBSD (release 8 and above), Linux, Mac OS X (Snow Leopard and above), and Windows operating systems with 32-bit (386) and 64-bit (amd64) x86 processor architectures. 
Brief
Epsilon
vm or vi
Emacs
VS Code

Explanation of the syntax of Go program:

Line 1: It contains the package main of the program, which have overall content of the program.It is the initial point to run the program, So it is compulsory to write.
Line 2: It contains import “fmt”, it is a preprocessor command which tells the compiler to include the files lying in the package.
Line 3: main function, it is beginning of execution of program.
Line 4: fmt.Println() is a standard library function to print something as a output on screen.In this, fmt package has transmitted Println method which is used to display the output.
Comment: Comments are used for explaining code and are used in similar manner as in Java or C or C++. Compilers ignore the comment entries and does not execute them. Comments can be of single line or multiple lines.

Single Line Comment:

Syntax:
// single line comment
Multi-line Comment:
Syntax:
/* multiline comment */
Advantages:

Flexible- It is concise, simple and easy to read.
Concurrency- It allows multiple process running simultaneously and effectively.
Quick Outcome- Its compilation time is very fast.
Library- It provides a rich standard library.
Garbage collection- It is a key feature of go. Go excels in giving a lot of control over memory allocation and has dramatically reduced latency in the most recent versions of the garbage collector.
It validates for the interface and type embedding.

Disadvantages:
It has no support for generics, even if there are many discussions about it.
The packages distributed with this programming language is quite useful but Go is not so object-oriented in the conventional sense.
There is absence of some libraries especially a UI tool kit.


Posted on by