3 ms·
This looks like an attempt to turn Go into Java/C#. I certainly won’t allow this to be used by the engineering teams under me.
by abtinf 2y ago
This looks like an attempt to turn Go into Java/C#.
I certainly won’t allow this to be used by the engineering teams under me.
- cpuguy83 2y agoIt's attempt to provide a much more efficient and harder to misuse implementation to a project used in tons of places.
- Zababa 2y agoI don't think it is. Effective Go says that Go doesn't provide automatic support for getters and setters but there's nothing wrong with providing them yourself. Since in that case they are actually doing something (checking/updating the bitfield that contains the presence of each field), it makes sense to use them. They are called `GetFoo()` instead of the idiomatic `Foo()`, but that is to ensure compatibility with the API where the fields are directly exposed as `Foo`, which also makes sense.
- pensatoio 2y agoWhy? I'm going to encourage my engineers and other teams to use it. Using this API would 100% have prevented bugs created by accessing the generated structs directly, especially in the presence of an optional value.