Safer Enums · npf.io
npf.io/2022/05/safer-enumsThere’s no size difference between a string and a
struct{ string }
and it’s just as easy to read as a straight string. Because of theString()
method, you can pass these values to%s
etc in format strings and they’ll print out the name with no extra code or work.