It got them back in 1.18. Not every project and library has upgraded to that yet but at least modern tools have generics.
Things were done the Go way, with specific implementations. You had maps, slices, and arrays, and those were all the generics in the language. Supplement the lack of generics by stuffing functions using generics into interfaces and then implementing those interfaces for every type you need to call the function on.
Didn’t it only recently get generics? How was stuff even done before then?
It got them back in 1.18. Not every project and library has upgraded to that yet but at least modern tools have generics.
Things were done the Go way, with specific implementations. You had maps, slices, and arrays, and those were all the generics in the language. Supplement the lack of generics by stuffing functions using generics into interfaces and then implementing those interfaces for every type you need to call the function on.
interface {}
- which is the equivalent of C/C++’void *
.