18 ms·
For #1, the "internal" package magic name allows you to have "private public" types; types that are public in terms of what reflect thinks about them, but are p
by jerf 9y ago
For #1, the "internal" package magic name allows you to have "private public" types; types that are public in terms of what reflect thinks about them, but are private in the sense that external packages still can't get at them (which is the operational definition of "private" in Go) so it's safe to have all of their attributes be "public", i.e., start with capital letters.
I often use the "internal" when I have a package with a lot of internal-only marshaling behaviors, so that the godoc for the package isn't made up of 80% internal implementation details and 20% payload.
"As nesting maps is a pain"
Spend a few years in Perl with its autovivication and it'll seem a lot less painful. However, this is just an observation, not an actual recommendation.