Golang, a strong-typed language allows the ability to group constants together in parenthesis with the iota keyword. But coupling that with a string representation can add extra boilerplate code. Let’s first take a look at how constants and enums are created in Go.
A recap on constants and enums in Go…
For example, as constants by placing them in parenthesis:
const ( Dog = 0 Cat = 1 Bird = 2 )
Using the iota keyword to make an enum:
const ( Dog = iota Cat Bird
I was asked by a former colleague who was recently promoted to a manager for tips on being an effective leader. This was a great question and let me self reflect on my styles, beliefs and motivation within my own career.