The Go programming language, also known as Golang, is a programming language developed by Google engineers in 2007 as a C alternative. Go is aimed to facilitate certain aspect of programming that big companies like google suffer from.
Golang Main Characteristics
- Concurrency Support
- Statically-typed. (variable types are known at compile time)
- Garbage Collection
- Cross-Platform Support
Why Did Google Create Go
When hearing about a new programming language, one cannot help but wonder why it was created? There are so many programming languages out there that serve different purposes. Do we really need to add to the confusion?! To answer that question we need to understand the challenges a company like Google faces.
Google is a very big company, as of today (2022) google operates 30 datacenters worldwide, running hundreds of thousands of servers. These servers constantly scan the internet and process webpages so you can have the perfect google search experience.
Google has specific needs when it comes to programming languages.
Fast compilation: The code needs to compile fast. Code compilation could pose a problem when it takes hours to push a slight change to the code base. Go compiles fast by simplifying the dependency analysis process and avoiding much of the overhead of C-style inclusion of files and libraries.
String processing: Google reads and analyzes a lot of text files. String manipulation must be simple and well supported by the language by providing clear syntax and rich libraries. Go has a rich libraries of string functions, also the Garbage collection makes strings in Go simple to think about, and efficient.
Concurrency: Large programs are often made up of many sub-programs. This is especially true of web servers that handle each request in a separate thread, this is to make progress on all requests which is crucial for user experience. Go introduces goroutines which are functions that run concurrently with other functions. To make a goroutine we use the keyword “go”. which is a very elegant way that removes the overhead of creating threads.