Common Anti-Patterns in Go

It has been widely acknowledged that coding is an art, and like every artisan who crafts wonderful art and is proud of them, we as developers are also really proud of the code we write. In order to achieve the best results, artists constantly keep searching for ways and tools to improve their craft. Similarly, we as developers keep leveling up our skills and remain curious to know the answer to the single most important question — 'How to write good code.'

Frederick P. Brooks in his book 'The Mythical Man Month: Essays on Software Engineering' wrote:

Structure of a Go Program

Every single programming language has got its own syntax or structure, it’s own flavor, and that’s what makes it standout. Go is no different. It’s easy and elegant in its own way, making to it fun to play with. In this article we will be talking about:

  • A Go program structure.
  • Running a Go program.
  • Comments in Go.
  • Semicolons.
  • Revisiting the code.

Go Program Structure

To understand a Go program's structure, we need to have a Go program first, so let’s revisit our favorite Hello, World! program.