*What?*
https://github.com/nikolaydubina/go-enum-encoding
```go
type Color struct{ c uint8 }
//go:generate go-enum-encoding -type=Color
var (
UndefinedColor = Color{} // json:"-"
Red = Color{1} // json:"red"
Green = Color{2} // json:"green"
Blue = Color{3} // json:"blue"
)
```
This tool extends json tag notation to variables and generates JSON
encoding/decoding boilerplate.
*More Details*
To generate boilerplate JSON encoding/decoding blocks.
This is very lightweight solution of <100 LOC single-file with 100% test
coverage. It even generates tests for generated code as well.
I really liked this syntax, so would like to share to others. Cheers!
--
You received this message because you are subscribed to the Google Groups
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/golang-nuts/561640bd-e00d-4db6-8a4a-898f026ca946n%40googlegroups.com.