Since an object is only accessed through its interface, there is no inherent way to access member variables from outside the object. We need getters and setters.
We can assume that if a member begins with a capital letter, we want getters and setters on it, as if it were public. Lower case means no getters or setters. It can also be controlled further with a struct tag (which would need to be parsed to be used.)
M1 string `gs:"out"`
M2 int
m3 int
m4 float64
The getters and setters would be idiomatic go, in that getters are just the Capitalized name of the member, and setters use the initial "Set" word. As in:
Since an object is only accessed through its interface, there is no inherent way to access member variables from outside the object. We need getters and setters.
We can assume that if a member begins with a capital letter, we want getters and setters on it, as if it were public. Lower case means no getters or setters. It can also be controlled further with a struct tag (which would need to be parsed to be used.)
The getters and setters would be idiomatic go, in that getters are just the Capitalized name of the member, and setters use the initial "Set" word. As in:
Would be generated for the above.