According to Wikipedia, “Go (often referred to as Golang) is a programming language created at Google in 2009 by Robert Griesemer, Rob Pike, and Ken Thompson. Go is a statically typed compiled language in the tradition of C, with memory safety, garbage collection, structural typing, and CSP-style concurrent programming features added. The compiler and other tools originally developed by Google are all free and open source. (It was designed as) a new programming language that would resolve common criticisms of other languages while maintaining their positive characteristics.“
Go is a procedural programming language because procedures (functions) are stitched together to form a program. It is an imperative programming language because functions are built out of statements, which are generally phrased as imperative commands.
So, what are the benefits of using Go? Here are just some of them:
In May 2014, Brad Fitzpatrick made a presentation at the GoCon conference in Tokyo. In it he gave this comparison of Go to other common languages.
He believes that C still represents the fastest and most efficient language for executing computer commands, but that it is also a difficult language to develop in. However, he sees Go as competing with C in speed, but being easier for developers to create in. Another advantage is that most of the previous languages are written to run on a single processor. With multiple processors now the norm, we need a language that is designed to exploit multi-processing.
Go is fast and efficient for computers, but also fast and fun for humans. You are probably familiar with many of the other scripting languages shown above, but generally they are not as fast to execute as Go. Go seems to be in a sweet spot between speed and usability.
Since Go has been written to take advantage of multiple cores natively, it knows how to use them and to and scale horizontally as well. It can manage concurrency easily, since the concept is natively baked into Go. Go offers beautiful, straightforward code, which means it is easy to write.
Go has clean sense syntax that writes almost like a scripting language.
Compilation efficiency is one of the main reasons why Go was developed. As a result, its creators have developed a language with impressively rapid build times. Unlike for example, C++ which has to re-read header files, Go avoids slowing down the compiler by side-stepping some of the pitfalls of other languages. Go’s dependency management is much more efficient and operates across all modules thereby improving speed.
The release of Go 1.8 came with a 15% improvement in compilation times. They also announced that they will continue to focus on further lowering compiling times in future releases.
Go has garbage collection, so it manages all your memory for you – and it does it in a very good way. Since the creators of Go have really focused on awesome garbage collection features, memory management is no longer an issue you have to worry about.
Powerful Standard Libraries
Go has very powerful standard libraries that let you undertake many high-level tasks quickly. Go is designed with web development in mind, which is why it has a standard library for dealing with JSON. Most languages rely on an open source library to deal with JSON, while Go has built in JSON handling.
Go compiles to various operating systems. You can develop on one machine and compile to run on a different architecture – and it works!
Packages that your app depends on will be automatically included in the generated binary, so all you have to do is ship it to the users.
Backed by Google
Go is powered by Google, which was one of the strongest reasons for that developers choose Go in the first place. Google designed Go from the beginning to support scalability and effectiveness, making it ideal for cloud based application development.
Go has been provided by Google as open source. If you really get into it and want to contribute to the project, you can do that too.
There are many off-the-shelf open source libraries available to developers. Their subrepo, is comprehensive and easy to use.
Companies using Golang
Many major organisations have adopted Go, here are just a few :
This statement from a user at the qihoo Go Language blog may illustrate what Go can do:
“Initially, our Go-based system ran on 20 servers, with 20 million real-time connections in total. The system sent 2 million messages a day. That system now runs on 400 servers, supporting 200 million+ real-time connections. It now sends over 10 billion messages daily.”
So maybe now is the time to switch!
By: Mohammad Nhasa, Analyst Programmer at Mitrais