|
|
|
|
|
by marklar423
844 days ago
|
|
If you're using protobufs anyway, you can get also get this functionality generated by using a proto enum: https://protobuf.dev/reference/go/go-generated/#enum. It works really nicely and has all the features mentioned in the article. One added benefit is it serializes/deserializes safely (even when you add / remove values), so you can persist and read back values without a problem - even to a different language. |
|