enumcheck icon indicating copy to clipboard operation
enumcheck copied to clipboard

Use package to annotate types intead of comments.

Open egonelbre opened this issue 6 years ago • 1 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.

egonelbre avatar Dec 06 '19 15:12 egonelbre

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)
}

egonelbre avatar Jan 26 '20 03:01 egonelbre