2 ms·
> Docker and Kubernetes Both of these projects have had to go way out of their way to make things work without generics, but they are large enough projects and
by sam0x17 5y ago
> Docker and Kubernetes
Both of these projects have had to go way out of their way to make things work without generics, but they are large enough projects and have enough resources that they can do this. Both are actually really great examples of why Go is a bad choice until generics are added and have first-class support. Even C would be preferable over something where there are no generics.
- hactually 5y agoYou're incorrect but that's OK. I've been writing Golang for 5 years and have never had need for generics. It's nothing to with resources, it's just understanding how to build software. Your retreat to C is a bit sad - I'd be happy to help you if you've got any Go you're struggling with?
- jrockway 5y agoKubernetes does in fact need generics. There are types that all work the same but are different types all over the place. For example, you might make a reflector for a v1.Node, and that will call methods on your cache that are like Add(v1.Object), when the signatures should really be v1.Node. Instead, you have to cast the API to your internal implementation. It's not a big deal, but it's a solid example of something that generics would clean up.
- the-smug-one 5y agoI wrote Go for 3 days at my new job and found several places where people opted for interface{} over generics.