Avatar ·

Idiomatic way to represent enums in Go

Hi everyone! I'm new to Go, coming from Python and Java, and I can't find a proper way to make an enum. In other languages I'm used to writing something like: ```python class Color(Enum): RED = 1 GREEN = 2 BLUE = 3 ``` In Go, there is no built-in `enum` type. I tried using constants with `const` and `iota`, but it feels incomplete. For example, I want to create a type for order status: `New`, `Processing`, `Shipped`, `Delivered`, `Cancelled`. I need: 1. A variable to be able to take only one of these values. 2. The ability to check if a value is valid. 3. It would be nice to have a `String()` method for pretty output. 4. And for it to be idiomatic, as is customary in the Go community. So far I've done this: ```go package