What is Golang*?

Go* (yes Go, not Golang. Golang is the official website address www.golang.org and a colloquial name that makes it easier to search for help in google:) )

it is a language which has been with us for 10 years, so if we compare this to java, phyton, c#, c, cpp it is quite a new language. The work started in September 2007 and the first release was in November 2009. 

Supposedly the idea of creating a new language was born when three members of Google, Robert Griesemen, Rob Pike and Ken Thompson when they were annoyed with the time it took to compile their cpp program, they started talking about what a modern programming language should look like*(at all is not 100% true, but sound nice 🙂 ). They had time because they waited for their cpp program to compile. And this is how the concept was created:

  • comprehensible and easy to use for developers (write, read and debug)
  • fast to work in
  • statically typed 
  • fast compiling
  • scaled well
  • as self-sufficient as possible
  • automatic memory management (garbage collection)
  • easy multicore computing (with modern CPU)
  • good at networking
  • and some other things that pissed off our heroes 😉              

So Go is a new generation language and summarizing the goals of the creators, they wanted to get rid of the complexities and ineffectiveness of contemporary languages such as c ++ / java, which were most often used in everyday work.

11 years have passed and what does He look like now … how did he meet his tasks and what future awaits him …

Companies using Go

One of the determinants of whether a language is worth paying attention to is the fact which large companies use it. Go can boast in this field, for example: 

  1. Google (it is obvious)
  2. Uber
  3. Twitch
  4. Dailymotion
  5. Dropbox
  6. SoundCloud

Much more you can find here: https://github.com/golang/go/wiki/GoUsers

And I want to stay at this paragraph a little bit longer and provide some field where Golang is used often – it is cloud computing

Nowadays, when working in the cloud has become a standard, it has become very important that programs can provide a solution where scalability and competitive access to resources is at a very high and secure level, and Go was created for this. If we add the fact that Docker and Kubernatus are written in Go, I can easily answer one of the previously asked questions, that it does its job well and is great in the modern world of programming. 

How Go looks?

It is very easy to learn the Go syntax, this is also one of the developers’ assumptions, so they keep their word and so the traditional _hello world_ looks like this:

package main

import (

“fmt”

)

func main() {

fmt.Println(“Hello World”)

}

Very easy You can try it yourself. Go provide us “playground”, where you can get acquainted with Go, its syntax and basic mechanisms:

https://play.golang.org/

For example, we have package declaration (the programs in go consist of package), import part (what other package we are using) and func main() to start our program… of course, we have some other keywords in Go but here is once again the creators’ idea of simplicity, go has only 25 keywords, where there are many more in other languages (c 32, c++ 60, java 52, phyton 33, rust 58). a good example of this is the word for. In the Go syntax, there is only one “for” loop that can replace all other known loops like while, infinite, passing through an array, etc. (add some examples for this loop??)

About how code in Go looks we need to mention a very cool feature. The compiler it self care that code will be formatted incorrect way. Yes Go has only one way to format code, so whenever you need to look into some code you will be getting used to it. In addition, the compiler will also make sure that each declared variable is used, which affects the performance of the program itself. If we don’t use any variables anywhere, the compiler will report an error. 

Some other good features of Go

Go has a lot to offer, but I want to show things that are unique in my opinion.

Go has no problems compiling the code you wrote so that you can run it on another machine … You are working on Linux, but the program will run on Windows or Mac, no problem with the appropriate command during compilation will do the trick and this is a natively built-in function. It is worth adding that programs in Go compile into an executable binary.

Along with Go, we get a package of as many as 17 additional tools to support our work. These are, among others, fmt for code formatting, doc for viewing documentation (both for the language itself and for the one added to our programs), test – a testing tool built into the language itself, for unit tests and benchmarks,

Mod as a dependency management tool in Go

And another thing about managing dependencies. In the programming world, we are used to the fact that we use various additional libraries, external or our own, for most languages, it is required that there is a separate server with such libraries. For java maven, for JS npm, phyton pip … and for Go, we have a GIT. Almost the whole world uses Git in their projects and a repository server can be a library server for Go, just add the URL to the project and you’re ready to go. It is great to make your work easier and to take advantage of the existing solutions.