It can be found in many libraries in the ecosystem, and is common enough in the standard library.
The lack of generics just severely restricts the expressiveness of the type system.
I think the best way to work around this is use of code generation, which is a great tool for internal, controlled environments, but very cumbersome for open source libraries.
I don’t see much, if any, generated Go code at Google. Not to say that it doesn’t happen but it’s not on my radar.
Here is an example: https://github.com/google/gvisor - https://github.com/google/gvisor/tree/master/tools/go_generi...
It was useful enough that someone made a standalone package: https://github.com/mmatczuk/go_generics
Kubernetes makes heavy use of generated code, as workaround for lack of generics.
They even gave a FOSDEM talk about this, with a very interesting title.
https://fosdem.org/2019/schedule/event/kubernetesclusterfuck...
Aren't http or grpc apis autogenerated? You'd be crazy not to use a generator for those.
Re:Go Creeping In
by happythought on Tuesday June 18, 2019 @10:55AM
(#20213749)
I don’t have the experience you do, but I feel like it comes up a lot when working with dictionaries and json.
Re:Go Creeping In
by samnardoni on Tuesday June 18, 2019 @08:34AM
(#20212296)
sync.Map?
I’m totally biased because I’ve worked on and with go for a decade, including reviewing all sorts of Go we write at Google, but I just don’t get this criticism. It’s just not something I see in the code bases I work on. I admit that I may be working on different kinds of programs to what some others do, and I don’t want to deny anyone their legitimate experiences, but my personal experience has been that this is rarely a thing, if ever.