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

FWIW the 'tag' concept in Go alleviates concern #2.

Info regarding tags (scroll a bit): http://golang.org/ref/spec#Struct_types

How tags are used by the built-in JSON encoding library: http://golang.org/pkg/encoding/json/#Marshal

Of course, just because this kind of thing can be handled with tags doesn't mean that people will actually know to use them or actually use them correctly.



thanks for that! i wasn't even aware of field tags.

i can see this solution causing other problems too. there can only be one tag per field, right? what happens when another library has a different meaning for the tag?

are we going to see a hacky standard emerge where we have multiple tags in the one field separated by semicolons (with a precursor for each tag like 'json:')?

it feels like an ugly hack to use tags this way, but i guess an ugly hack is what is needed for this right now.

i would much prefer a separate keyword to explicitly export fields. or, since we are already hacking the tag, why not have the compiler export any field with a tag called "export"?




Consider applying for YC's Fall 2026 batch! Applications are open till July 27.

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

Search: