You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
How do you specify whether a struct field is exported or not when the field names are in a non-Latin language that doesn't have the concept of uppercase and lowercase?
For example:
export/inner/inner.go:
package inner
typeXstruct {
名前string// How do I change the visibility?
}
funcNewX(名前string) *X {
return&X{名前: 名前}
}
export/main.go:
package main
import (
"export/inner""fmt"
)
funcmain() {
v:=inner.NewX("長島")
// ./main.go:12:46: v.名前 undefined (cannot refer to unexported field or method 名前)fmt.Printf("こんにちは、%vさん\n", v.名前)
}
The text was updated successfully, but these errors were encountered:
As @mattn said, this is #5763, and also #22188 for the search for a solution to this issue. Regarding your question, what it's usually done is to put an upper-case latin letter at the beginning of the name to export it.
Closing here as a question (which was answered) and a dup of #22188 (for a solution).
How do you specify whether a struct field is exported or not when the field names are in a non-Latin language that doesn't have the concept of uppercase and lowercase?
For example:
export/inner/inner.go:
export/main.go:
The text was updated successfully, but these errors were encountered: