Open In App

Introduction to Go Programming

Go (also referred as Golang) is a procedural and statically-typed programming language having syntax similar to C language. It provides a rich standard library, garbage collection, and dynamic-typing capability. 
This language also has key-value maps, length arrays features which are advance level built-in types. Go is the most powerful, performant, and scalable programming language for creating web applications, web APIs, micro-services, and other distributed services. It is one of the fastest-growing, highest-paying programming languages in America.
Evolution of Golang:
The Golang was designed by Robert Griesemer, Rob Pike, and Ken Thompson in 2007 at Google. It was launched in November 2009 as an open-source programming language. The main purpose of designing Golang was to solve the problems of other languages by keeping their useful features. In March 2012, its Version 1.0 was released. The latest version is 1.11.1 which released in 2018.
Why Golang? 
The main purpose of designing Golang was to eliminate the problems of existing languages. So we started with the problems that we are facing with Python, Java, C/C++ languages: 
 

Features of Golang:
 



 

Beginning with Golang Programming

Programming in Golang: Since the Golang is a lot similar to other widely used languages syntactically, it is easier to code and learn in Golang. Programs can be written in Golang in any of the widely used text editors like Notepad++, gedit etc. or on any of the text-editors. After writing the program, save the file with the extension .go or .GO
There are various online IDEs such as The Go Playground, repl.it etc. which can be used to run Go programs without installing it. For installing Go in PCs or Laptops, we need of two software Text editor which gives you a platform where you write your source code and compiler. The text editors may be OS Edit Command, Brief, vm or vi, notepad, notepad++, etc. 
Example : A simple program to print Hello Geeks!.
 






package main 
  
import "fmt"
 
func main() {
 
     // prints Hello, Geeks!
     fmt.Println("Hello, Geeks!")
}

Output: 
 

Hello, Geeks!

Explanation of the syntax of Go program: 
 

// single line comment 
  1. Multi line Comment: 
    Syntax:
     
/* multiline comment */

Advantages
 

  1. Fast: Go has no Virtual Machine, it can compile directly to the machine code. Excluding Go’s intermediary assembly makes it really fast.
  2. Easy to learn: There is a slight change in the syntax, as it looks almost similar to other programming languages languages.
  3. Concurrency: It allows multiple process running simultaneously and effectively.
  4. Open source: It is free and open source and community is always there to help you out.
  5. 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.
  6. Built-in testing tool: Golang has built-in testing tool which make it more rich and easy to debug.

Disadvantages: 
 

 


Article Tags :