enumcheck
enumcheck copied to clipboard
Allows to mark Go enum types as exhaustive.
Instead of using comments to annotate types, use either function calls or stub interfaces. Either of these could work: ``` type Letter byte var _ enum.Exhaustive = Letter(0) ``` ```...
Currently exhaustively writing all the cases for conversions seems too verbose and error-prone. There should be a better way, since the compiler already does the conversion somewhere.
``` go type Letter byte // checkenum type Alphabet { First Letter } func main() { fmt.Println(Alphabet{123}) } ```