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­ni­ca­tion ap­pli­ca­tions such as Gmail, office solutions such as Google Docs, and even hardware such as the smart­phone Pixel. In addition, the large cor­po­ra­tion has been providing web and software de­vel­op­ers with valuable tools for years. Since March 2012, the in­creas­ing­ly popular pro­gram­ming language Go, or Golang, has been part of the Internet service provider's portfolio.

What is Golang?

In September 2007, Google de­vel­op­ers Robert Griesemer, Rob Pike and Ken Thompson focused their attention on creating an optimized, sim­pli­fied pro­gram­ming language – laying the foun­da­tion for Go and Golang re­spec­tive­ly. What started out as a small-scale project quickly developed into an ambitious un­der­tak­ing, and Google de­lib­er­ate­ly en­cour­aged its de­vel­op­ment by providing the company with the necessary resources. After Go was of­fi­cial­ly 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­ti­miza­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­po­rat­ed, which in turn are inspired by Tony Hoare’s process algebra CSP (com­mu­ni­cat­ing sequential processes). Golang is com­pat­i­ble, 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 rel­a­tive­ly young compared to other pro­gram­ming languages, it’s already so mature and stable that it’s used by de­vel­op­ers all over the world – even Google uses it. Golang is char­ac­ter­ized by sim­plic­i­ty and multi-func­tion­al­i­ty, which the de­vel­op­ers 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­pi­la­tion, fast code execution, or a simple pro­gram­ming process, but never combine all three ad­van­tages.

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­guish­es in­ter­pret­ed, dynamic language from the ef­fi­cien­cy and security of a sta­t­i­cal­ly 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­e­cutable files on a single computer in seconds. Some of the key Golang char­ac­ter­is­tics which achieve this standard are:

  • An ex­pres­sive but light­weight type system for the optimal clas­si­fi­ca­tion and dif­fer­en­ti­a­tion of the various objects (variables, functions, etc.)
  • Con­cur­ren­cy (parallel pro­gram­ming) for faster program execution
  • Automatic garbage col­lec­tion (GC) for optimal use of available memory and to avoid memory problems
  • A strict spec­i­fi­ca­tion of de­pen­den­cies without complex de­c­la­ra­tion syntax
  • Platform-in­de­pen­dence, which enables the use of developed ap­pli­ca­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­nif­i­cant­ly reduced scope. When pro­gram­ming with Golang, there are no mandatory round brackets for con­di­tions and loops, and the ter­mi­nat­ing semicolon typical of the C family is optional. In addition, the validity of iden­ti­fiers 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­i­tal­ize the first letter. Below are some other special features of pro­gram­ming with Golang:

  • GOPATH en­vi­ron­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­di­rec­to­ries ‘src’ (go source files),’pkg’, ’GOPATH’, (go package objects), and ‘bin’ (ex­e­cutable commands). Any Go code that is written can be managed via this workspace, including the cor­re­spond­ing de­pen­den­cies. The location of this oblig­a­tory GOPATH directory can be chosen freely.
     
  • Modular structure with GOLANG packages: source files can be organized modularly in Golang using di­rec­to­ries 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­i­tal­iza­tion of the cor­re­spond­ing iden­ti­fi­er mentioned above must be used.
     
  • Uniform, mandatory code for­mat­ting: Golang specifies certain con­ven­tions for for­mat­ting the code, such as exact spacing between elements. So, if you've learned how to program ap­pli­ca­tions with Golang, you can easily read other de­vel­op­er­s' code without having to decipher their personal for­mat­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­te­grat­ed tool gofmt optimizes written Golang code au­to­mat­i­cal­ly by fixing incorrect for­mat­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­po­nents 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­ter­na­tive­ly 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­a­rate­ly.

Ad­van­tages and uses of Golang

Many of Golang's primary strengths have already been discussed in this article. Because of its sim­plic­i­ty, the Google language offers de­vel­op­ers much more ease in their work compared to many other pro­gram­ming languages. Those who have in­ter­nal­ized the basics will benefit from the simple operation and numerous au­toma­tisms, which save a con­sid­er­able amount of time. Thanks to these tools, such as the in­de­pen­dent­ly acting gofmt for automatic code op­ti­miza­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­o­ra­tive­ly in a team.

Another strength of Golang pro­gram­ming is the good per­for­mance of the pro­gram­ming language. The execution speed of Go ap­pli­ca­tions is generally superior compared to other compiler languages. The com­pi­la­tion speed roughly cor­re­sponds to that of Java. However, while many Java ap­pli­ca­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­men­ta­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­vi­ron­ment, where the stability and per­for­mance of services play an important role. The young pro­gram­ming language is in demand, par­tic­u­lar­ly in the case of container-based vir­tu­al­iza­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­ness­es. These are primarily due to the sim­plic­i­ty 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­vel­op­ers 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­si­bil­i­ty of spec­i­fy­ing in­di­vid­ual type pa­ra­me­ters) 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­men­ta­tion of generic types in future versions. The aban­don­ment of classes, in­her­i­tance, and con­struc­tors is also something that many de­vel­op­ers 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­ti­cal. Other languages score here due to the pos­si­bil­i­ty of ‘com­ment­ing out’ cor­re­spond­ing com­po­nents, so that they are retained in the program code – despite in­ac­tiv­i­ty.

Another dis­ad­van­tage 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­portable 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­te­grat­ed de­vel­op­ment en­vi­ron­ments)
Uniform code for­mat­ting Com­par­a­tive­ly 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 Rel­a­tive­ly few experts and tutorials (as of yet)
Automated code cor­rec­tion (gofmt)  
Con­cur­ren­cy  
Extensive standard library (es­pe­cial­ly 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­ter­na­tive. Thanks to its ef­fi­cien­cy and out­stand­ing per­for­mance, which is also reflected in the pro­grammed ap­pli­ca­tions, it’s an in­ter­est­ing choice es­pe­cial­ly 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­plic­i­ty of a modern language. Since there are not yet very many Go experts, fa­mil­iar­iz­ing yourself with the Golang pro­gram­ming language might just yield great op­por­tu­ni­ties – be it in a job ap­pli­ca­tion for a developer position, or in starting up a new project.

Go to Main Menu