Avoid getters and setters whenever possible
I have trouble articulating this point, but I never understood the argument why you’d want getters or setters at all.<p>From my point of view, your data structures <i>are</i> your API.  Attempting to hide them behind methods so that you can do something clever doesn’t work when it’s not always you that constructs the data (I’m thinking of things like json deserialization and accepting data from outside your control.).<p>All the arguments behind getters and setters seem rooted in this fear that maybe you’ll change your mind later about your data, but somehow you won’t have to change the function signatures of your getters&#x2F;setters when that happens... this seems so contrived to me it’s insane to design entire frameworks and paradigms with this as a central idea.<p>Maybe I’ve been using Go for a bit too long now but I really think the mixing of data and logic is a fundamental mistake.