4 ms·
What's wrong with struct tags?
by icholy 10y ago
What's wrong with struct tags?
- grey-area 10y agoI think I'm the only go user who doesn't like them :) IMO they mix up separate concerns, use an ad-hoc syntax and end up a mess in complex apps, it's like a whole other language stuffed into a string and defined by random lib authors. A field might have json, xml, db tags all in one string. But there's no chance they'll be removed.
- cypher543 10y agoI don't like them either, so you're not alone. Nor do I like comments as compiler directives. Go needs a proper attribute syntax that works with the package system (so attributes don't collide) and can be applied to everything, including struct fields.