Closed achille-roussel closed 7 years ago
Should just go generate this.
I've never used go generate but I'm happy to rework it to auto-generate the values. Do you know of any good reads on this topic?
Not sure how I originally discovered it, but these docs are pretty good https://godoc.org/golang.org/x/tools/cmd/stringer.
It'll generate something like https://github.com/segmentio/event-rules-counters/blob/master/precision/p_string.go.
You can "automate" it with go generate like this https://github.com/segmentio/event-rules-counters/blob/master/precision/precision.go#L10.
behaviour wise, it'll be slightly different from your current implementation. e.g. CounterType
will print CounterType
not counter
as currently implemented.
Useful for debugging purposes.