News for hackers. Stuff that matters.
Re:Go: Ten years and climbing by christophilus on Thursday September 21, 2017 @10:20PM (#15308969)
Yeah. The repeating the field, only camelCased, in JSON annotations feels needlessly painful to me. Subjective, I know, but that kind of painfulness seems pervasive in my (brief) dabbling with Go, and is one of the main reasons I moved on.
Re:Go: Ten years and climbing by pbohun on Thursday September 21, 2017 @10:41PM (#15309059)
The json annotation is optional, but very powerful since it allows you to set the mapped name of the field to any name you like, allowing you to map json fields with snake_case, CamelCase, kebab-case, etc.
Re:Go: Ten years and climbing by ovao on Thursday September 21, 2017 @10:56PM (#15309112)
One alternative to writing struct tags by hand is to write a little generator code to map the field names from, say, a reference .json, then calling `go generate` as part of your build process.

I've wondered whether a wrapper library could do rule-based field name mapping automatically with Go's reflection facilities (which could be a productivity win), but I haven't really looked at it closely.