Kent Rancourt
1 min readJul 1, 2019

--

My comparisons to Java may have been mistaken as an attempt to treat Go like an OO language when, in fact, I did not intend to imply that. That fact that it is not an OO language is not lost on me. That being said, Go does have some OO-like features and its own official documentation makes note of this. It’s not at all accidental that structs exist in Go, are able to encapsulate data, and are able to act as function receivers. I think it would be hard to argue that no valid uses for these features exist. If valid uses do exist, then the problem of initializing structs without leaking implementation details (for instance, the fact that some field must be initialized to a new UUID) to the user of the struct inevitably arises. The pattern I have laid out here is one possible solution to that, but was not intended to make Go somehow appear or act more OO than it is.

--

--

Kent Rancourt
Kent Rancourt

Written by Kent Rancourt

Kent is a founding engineer at Akuity, working primarily with Kubernetes, Argo CD, and other open source projects.

Responses (1)