Golang

Golang

A System Programming Language

Go is a powerful, efficient and easy-to-learn programming language that excels in various fields. You can work with system programming, web programming, cloud services, etc. The support for concurrency makes a great choice for modern software development.
The language was created in 2007, inside Google, it was designed to be a fast, reliable, and efficient language, that helps the developer to handle the complexity with simplicity.

Basic Sintax

  • Variables
var myVar int = 42

or

myVar := 42
  • Functions
func add(x, y int) int {
    return x + y
}
  • Comments
// this is a single-line comment

/* this is a
multi-line 
comment
*/

Pros

  1. Efficiency: with exceptional performance, making it a suitable choice for system programming, network services, and high-concurrency applications.
  2. Concurrency: designed with concurrency in mind. It provides goroutines and channels, making it easy to write concurrent and parallel programs.
  3. Simplicity: has a clean and straightforward syntax with a minimalistic approach, which reduces the learning curve for new developers.
  4. Strong Typing: statically-typed language, which helps catch errors at compile-time, improving code reliability.
  5. Built-in tools: it comes with a rich set of tools, such as the gofmt code formatter and the go get package manager.

Cons

  1. Lack of generics (this point was solved in Go 1.19 version): the language lacked support for generics.
  2. Small Standard Library: while Go’s STL is well-organized, it is intentionally kept small.

Minimal program

import "fmt"

func main(){
    fmt.Println("hello world!")
}

Basic hello world

The basic hello world is the equal to the minimal program to write in Golang.

0%