enumcheck
enumcheck copied to clipboard
Use package to annotate types intead of comments.
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)
type Letter byte
var _ = enum.Exhaustive(Letter(0))
This would allow to specify the different options more nicely or suppressing the error messages.
For exceptions to the default behavior in switches:
switch enum.Exhaustive(xyz); xyz {
For exceptions to the default behavior in func declarations:
func Example(xyz Value) {
enum.Exhaustive(xyz)
}