Go is a free open-source programming language created at Google by Robert Griesemer, Rob Pike, and Ken Thompson – best known for development of the Unix operating system. Google released version 1.0 of the Go language (“golang”) in March 2012, since when it has gained widespread popularity.
Go programs are written in plain text, then compiled into machine code by the Go compiler to produce an executable binary version.
The aims of the Go programming language are to be expressive, fast, efficient, reliable, and simple to write. Some programming languages, such as C or C++, are fast and reliable but not simple. Conversely, other programming languages such as Java or Python are simple to write but not so efficient.
Go is similar to the C programming language in many ways, and is sometimes referred to as a “C-like language” or “C for the 21st century”. But Go is much more than that, as it adopts good ideas from many other programming languages, yet avoids features that lead to complexity or unreliability.
Perhaps most importantly, Go introduces the ability to take advantage of multi-core CPU processing for concurrency using “goroutines” and “channels”. This provides the potential for the computer to deal with several things at the same time.
Although the Go language does not have the class structures found in Object Oriented Programming (OOP) languages, such as C++ or Java, its features do provide some degree of encapsulation, inheritance, and polymorphism – the three cornerstones of OOP.
The Go gopher – the iconic mascot of the Go programming language.
With so many programming languages to choose from, you may be wondering why you should choose to learn Go programming – so here are some of the advantages that Go offers:
The Go language is concise, like Python. It’s as simple to write as Python but is more efficient, like C++. This enables you to write code that is easy to read and maintain.
The Go source code is compiled to binary machine code that can be read directly by the computer, instead of being interpreted every time a program runs. This enables the Go programs you write to run faster than programs written for interpreted languages, like Python or PHP.
The Go Compiler
The Go compiler is fast and provides additional benefits, such as code optimization and error checking – it can detect unused variables in your code, missing imports that your code requires, and mistyped or invalid code. The Go compiler can also generate executable binaries for other operating systems. This enables you to compile your source code to run on multiple machines.
The Go language provides inherent support for concurrency with goroutines and channels. This enables you to write multi-threaded programs that could perform multiple tasks at the same time.
Automatic memory management is a key feature of the Go language. Its garbage collector runs concurrently with the program. This enables you to write program code without any concern for memory leakage.
Go is a statically typed language in which variables are explicitly declared to be of a particular fixed type. This enables errors to be caught early in the development process.
You may well recognize other advantages as you gain experience with the Go language.
Get started programming with Go with GO Programming in easy steps
£11.99 paperback / £9.99 ebook (+ VAT/ tax where applicable)
By Mike McGrath