Privacy is only enforced between packages, so anything in the same package as the struct can see the private fields.
So, on to the spec: https://golang.org/ref/spec#unicode_letter
> In The Unicode Standard 8.0, Section 4.5 "General Category" defines a set of character categories. Go treats all characters in any of the Letter categories Lu, Ll, Lt, Lm, or Lo as Unicode letters, and those in the Number category Nd as Unicode digits.
Which reads:
Lu = Letter, uppercase
Ll = Letter, lowercase
Lt = Letter, titlecase
Lm = Letter, modifier
Lo = Letter, other
So I suppose (but am not sure) the case you describe falls into Lo. type foo struct {
a int // "private"
B int // "public"
}
You cannot specify default values and Go refers to them as "exported" not private, but technically they are "private" in the sense that they can only be accessed via methods.If that is a concern, you can create a new package for your type.
1. the first character of the identifier's name is a Unicode upper case letter (Unicode class "Lu"); and
2. the identifier is declared in the package block or it is a field name or method name.
All other identifiers are not exported.
https://golang.org/ref/spec#Exported_identifiers
Both of the characters you asked about are lowercase:
http://www.fileformat.info/info/unicode/char/00df/index.htm
http://www.fileformat.info/info/unicode/char/0138/index.htm
Here's the full list of Lu characters:
http://www.fileformat.info/info/unicode/category/Lu/list.htm
An identifier may be exported to permit access to it from another package.
An identifier is exported if both:
the first character of the identifier's name is a Unicode upper case letter (Unicode class "Lu"); and
the identifier is declared in the package block or it is a field name or method name.
All other identifiers are not exported.I know in Japan and Germany it's still kinda common for larger companies to build codebases in local languages.
Which in turn can lead to these issues.