ARTICLE AD BOX
The Go spec states: "An identifier may be exported to permit access to it from another package. An identifier is exported if both: 1. ... 2. the identifier is declared in the package block or it is a field name or method name.".
The (implicit) package block is described as follows: Each package has a package block containing all Go source text for that package.
In my mind, this means that a struct defined like this would be part of the package block. (Also part of a function block.)
func F() { type A struct {} }But obviously A is not exported, so am I misunderstanding this?
If the point 2. above would read like this instead: "the identifier's scope is the package block or it is a field name or method name.", this would make more sense to me together with "The scope of an identifier denoting a constant, type, variable, or function (but not method) declared at top level (outside any function) is the package block."
