In go you don't strictly need magic numbers because you can define constants:
type Status int
const (
IoProblem Status = iota // we start at zero and go down from there
JsonParse
...
)
The problem is that there is no exhaustiveness with these constant groups. The type Number is not a closed set of just IoProblem and JsonParse like an enum in C. It is just an int.
In go you don't strictly need magic numbers because you can define constants:
The problem is that there is no exhaustiveness with these constant groups. The type Number is not a closed set of just IoProblem and JsonParse like an enum in C. It is just an int.