The fact that the name ‘Google’ now stands for much more than just a search engine should be well known. Its product range includes useful web services such as Google Maps, en­ter­tain­ment platforms such as YouTube and Google Music, com­mu­nic­a­tion ap­plic­a­tions such as Gmail, office solutions such as Google Docs, and even hardware such as the smart­phone Pixel. In addition, the large cor­por­a­tion has been providing web and software de­velopers with valuable tools for years. Since March 2012, the in­creas­ingly popular pro­gram­ming language Go, or Golang, has been part of the Internet service pro­vider­'s portfolio.

What is Golang?

In September 2007, Google de­velopers Robert Griesemer, Rob Pike and Ken Thompson focused their attention on creating an optimised, sim­pli­fied pro­gram­ming language – laying the found­a­tion for Go and Golang re­spect­ively. What started out as a small-scale project quickly developed into an ambitious un­der­tak­ing, and Google de­lib­er­ately en­cour­aged its de­vel­op­ment by providing the company with the necessary resources. After Go was of­fi­cially presented as an open source project (BSD license) at the end of 2011, it quickly found a large number of sup­port­ers in the community who are still involved in the further de­vel­op­ment and op­tim­isa­tion of the pro­gram­ming language. The final release of the first stable version (1.0) took place on March 28, 2012. Ever since version 1.1, which followed a year later, Google publishes updates about every six months.

Fact

The Golang mascot and logo – a gopher – was designed by Renée French, whose other creations include Glenda, the Plan 9 bunny. Rob Pike and Ken Thompson also played a major role in the Unix operating system developed by Bell Labs in the 1980s.

The syntax of Golang is strongly oriented towards the basic syntax of the C-family languages, but shows clear in­flu­ences from the languages Pascal, Modula, and Oberon developed by Niklaus Wirth. Aspects of languages such as Newsqueak and Limbo have also been in­cor­por­ated, which in turn are inspired by Tony Hoare’s process algebra CSP (com­mu­nic­at­ing sequential processes). Golang is com­pat­ible, and had a focus on high trans­la­tion speed from the beginning. In addition, the Golang pro­gram­ming language has an automatic garbage col­lec­tion (GC) which ensures optimal man­age­ment of the available memory resources in the back­ground, which prevents storage problems.

What kind of pro­gram­ming language is Golang?

Although Golang is still re­l­at­ively young compared to other pro­gram­ming languages, it’s already so mature and stable that it’s used by de­velopers all over the world – even Google uses it. Golang is char­ac­ter­ised by sim­pli­city and multi-func­tion­al­ity, which the de­velopers aimed for from the very beginning. One of the main reasons for the de­vel­op­ment of a new pro­gram­ming language was the dis­sat­is­fac­tion with es­tab­lished languages, which are either efficient in code com­pil­a­tion, fast code execution, or a simple pro­gram­ming process, but never combine all three ad­vant­ages.

By combining important features from different language families, Golang sets a good example for other pro­gram­ming languages: the Google language combines the ease of pro­gram­ming, which dis­tin­guishes in­ter­preted, dynamic language from the ef­fi­ciency and security of a stat­ic­ally typed, compiled language. In addition, Go's structure aims to provide a short de­vel­op­ment process that allows you to create large ex­ecut­able files on a single computer in seconds. Some of the key Golang char­ac­ter­ist­ics which achieve this standard are:

  • An ex­press­ive but light­weight type system for the optimal clas­si­fic­a­tion and dif­fer­en­ti­ation of the various objects (variables, functions, etc.)
  • Con­cur­rency (parallel pro­gram­ming) for faster programme execution
  • Automatic garbage col­lec­tion (GC) for optimal use of available memory and to avoid memory problems
  • A strict spe­cific­a­tion of de­pend­en­cies without complex de­clar­a­tion syntax
  • Platform-in­de­pend­ence, which enables the use of developed ap­plic­a­tions on all common systems

Pro­gram­ming with Golang – an overview of its features

The Go syntax is based on the classic syntax of C, but differs from the pro­gram­ming language developed in 1972 by a number of minor im­prove­ments and a sig­ni­fic­antly reduced scope. When pro­gram­ming with Golang, there are no mandatory round brackets for con­di­tions and loops, and the ter­min­at­ing semicolon typical of the C family is optional. In addition, the validity of iden­ti­fi­ers can be regulated by their spelling. For example, if you want an iden­ti­fi­er to be active outside of a specific Go package, you need to cap­it­al­ise the first letter. Below are some other special features of pro­gram­ming with Golang:

  • GOPATH en­vir­on­ment as a basis: One of the first official actions when pro­gram­ming with Go is to create the GOPATH directory, including the three sub­dir­ect­or­ies ‘src’ (go source files),’pkg’, ’GOPATH’, (go package objects), and ‘bin’ (ex­ecut­able commands). Any Go code that is written can be managed via this workspace, including the cor­res­pond­ing de­pend­en­cies. The location of this ob­lig­at­ory GOPATH directory can be chosen freely.
     
  • Modular structure with GOLANG packages: source files can be organised modularly in Golang using dir­ect­or­ies called packages. The name of the directory is also the name of the package to which all source files in this directory belong. If functions, types, etc. are to be used across packages, the cap­it­al­iz­a­tion of the cor­res­pond­ing iden­ti­fi­er mentioned above must be used.
     
  • Uniform, mandatory code format­ting: Golang specifies certain con­ven­tions for format­ting the code, such as exact spacing between elements. So, if you've learned how to programme ap­plic­a­tions with Golang, you can easily read other de­veloper­s' code without having to decipher their personal format­ting style, as is the case with many other languages. The format does not have to be kept down to the smallest detail by the author – the in­teg­rated tool gofmt optimises written Golang code auto­mat­ic­ally by fixing incorrect format­ting.
     
  • Relative imports as standard: All files and packages imported into Golang projects are always relative to the GOPATH/src directory, which makes the import process very easy. Fur­ther­more, Go does not compile imported elements unless they are actually used. In this way, a clean code is guar­an­teed even if imported com­pon­ents are not used.
     
  • Multiple return values for functions and methods: With Go you can create functions and methods that can return multiple values. This allows Go to clearly separate a valid result from an al­tern­at­ively specified error in return. In C, for example, written errors are expressed by a negative counter value, while the actual error code is stored sep­ar­ately.

Ad­vant­ages and uses of Golang

Many of Golang's primary strengths have already been discussed in this article. Because of its sim­pli­city, the Google language offers de­velopers much more ease in their work compared to many other pro­gram­ming languages. Those who have in­tern­al­ized the basics will benefit from the simple operation and numerous auto­mat­isms, which save a con­sid­er­able amount of time. Thanks to these tools, such as the in­de­pend­ently acting gofmt for automatic code op­tim­isa­tion, Go also provides the perfect answer to the ever-complex tasks that have to be mastered in software de­vel­op­ment. In addition, Golang code is always formatted in the same way, which makes it much easier to read and work with col­lab­or­at­ively in a team.

Another strength of Golang pro­gram­ming is the good per­form­ance of the pro­gram­ming language. The execution speed of Go ap­plic­a­tions is generally superior compared to other compiler languages. The com­pil­a­tion speed roughly cor­res­ponds to that of Java. However, while many Java ap­plic­a­tions are based on the Spring framework, and therefore take some time to respond to HTTP requests during the startup process, Golang services use the existing im­ple­ment­a­tions of the standard library, which speeds up the startup process con­sid­er­ably.

As a result, it’s not sur­pris­ing that Golang has so far been used primarily in the en­ter­prise and server en­vir­on­ment, where the stability and per­form­ance of services play an important role. The young pro­gram­ming language is in demand, par­tic­u­larly in the case of container-based vir­tu­al­iz­a­tion , which isn’t least due to the fact that Docker, as probably the most prominent example among the container platforms, is based on Go.

In what ways are other pro­gram­ming languages ahead of the game?

With all the praise for Google’s modern pro­gram­ming language, it should not be forgotten that it also has some minor weak­nesses. These are primarily due to the sim­pli­city of Golang, which on the one hand is its greatest strength, but on the other hand also means that it lacks certain facets that some de­velopers ap­pre­ci­ate in other pro­gram­ming languages.

First and foremost, the lack of generic types (i.e. data types with the pos­sib­il­ity of spe­cify­ing in­di­vidu­al type para­met­ers) in the standard library is a factor which should be mentioned. Those who advocate type-safe pro­gram­ming and the use of generics in Java, for example, would have to put up without a similar feature in Go – although the Go team has not ruled out the im­ple­ment­a­tion of generic types in future versions. The aban­don­ment of classes, in­her­it­ance, and con­struct­ors is also something that many de­velopers would need to get ac­cus­tomed to. Another Golang feature is the automatic blanking of non-active import files, which many find im­prac­tic­al. Other languages score here due to the pos­sib­il­ity of ‘com­ment­ing out’ cor­res­pond­ing com­pon­ents, so that they are retained in the programme code – despite in­activ­ity.

Another dis­ad­vant­age of Golang compared to old-school languages such as C, C++ and so on lies in the new history of the language. It has a much smaller arsenal of standard and im­port­able packages. There are also fewer manuals, tutorials, etc. for Go on the net than for other, better es­tab­lished pro­gram­ming languages.

An overview of the pros and cons of Golang

Pros Cons
Multi-platform No generic types
Sim­pli­fied syntax Only partially object-oriented
Automatic storage man­age­ment (garbage col­lec­tion) Support for IDEs could be expanded (in­teg­rated de­vel­op­ment en­vir­on­ments)
Uniform code format­ting Com­par­at­ively spare supply of third-party libraries and third-party packages
Easy import process Difficult shift from classic, object-oriented languages such as Java and C++
Multiple return values for functions and methods possible Re­l­at­ively few experts and tutorials (as of yet)
Automated code cor­rec­tion (gofmt)
Con­cur­rency
Extensive standard library (es­pe­cially for http and network tasks)

Summary: who should learn Golang?

This article has examined the basics and special features of the open source pro­gram­ming language, which perhaps raises the question: who should actually make the effort to learn pro­gram­ming with Golang? As is so often the case, there’s no general answer to this question, because Go has not been developed as a sub­sti­tute for all pro­gram­ming languages used to date, but as a possible al­tern­at­ive. Thanks to its ef­fi­ciency and out­stand­ing per­form­ance, which is also reflected in the pro­grammed ap­plic­a­tions, it’s an in­ter­est­ing choice es­pe­cially for the business and server sector. The more code that needs to be written and compiled, the more powerful these benefits will be.

For novice pro­gram­mers, the learning process with Golang is often easier – you’ll benefit from the sim­pli­city of a modern language. Since there are not yet very many Go experts, fa­mil­i­ar­iz­ing yourself with the Golang pro­gram­ming language might just yield great op­por­tun­it­ies – be it in a job ap­plic­a­tion for a developer position, or in starting up a new project.

Go to Main Menu