by lantastic · 2y ago · 0 comments
//go:generate go-enum -type=State
type State int
const (
Unknown State = 0
Disconnected = 1
Connected = 2
)
which then generates a separate file with implementations such as: func (i State) MarshalJSON() ([]byte, error) { ...
[0] https://pkg.go.dev/github.com/searKing/golang/tools/go-enum#...No comments yet.