Golang, Interfaces, and Enums So here’s a nice golang idiom that I ran across years ago that I found generally useful. Golang, unlike languages like c doesn’t natively support enumerations. Instead, constants typically are used when creating a list of enumerations. But, go is a strongly-typed language, so we can do better than simply using constants - we can type our enumeration with the use of a type declaration.
type DogState uint By defining a type for our enumeration, we can consistently pass and return typed-values among our functions operating on our enumeration.
Continue reading