Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

The introduction of the much more sane omitzero (in addition to the current omitempty) to the stdlib JSON package is quite nice.


Just fixed a bug where this behaviour bit us. Nice change, although I feel structtags harm us more than they provide.


It's a lowlight in the language in my opinion; while adding metadata to fields is neat, putting it in an untyped string where the parsing is left to the library is far from ideal. I'm pretty sure that eventually the language will move away from struct tags in favor of a language construct like annotations in other languages, but like with error handling, this will be a long and slow process.


I disagree. Hardly doubt golang will break existing code for that, especially considering that structtags are parsed at compile time. It makes a lot of sense to me that the compiler couldn’t care less about it, when that is 100% a library construct.


Finally,

   Timestamp time.Time `json:"timestamp,omitzero"`




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: