I just learned about the stringer utility from Rob Pike's atricle about
generate (https://blog.golang.org/generate).
I was wondering why the code generated by stringer has it's data in global
variables (example from the article)
const _Pill_name = "PlaceboAspirinIbuprofenParacetamol"
var _Pill_index = [...]uint8{0, 7, 14, 23, 34}
instead of them being internal to the definition of
func (i Pill) String() string
The godoc for stringer (https://godoc.org/golang.org/x/tools/cmd/stringer)
doesn't indicate that there are any other functions that these variables would
be needed for and I think it would be cleaner to get them out of the global
environment end encapsulate them to just where they're needed.
Am I missing something?
--
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].
For more options, visit https://groups.google.com/d/optout.