top | item 37175733

(no title)

shinies | 2 years ago

Here is an example in the standard library: https://pkg.go.dev/slices

discuss

order

assbuttbuttass|2 years ago

I've used the slices package and I agree it's useful. I was wondering more about generics use in application code

shinies|2 years ago

Before the slices package you had to write those functions for all your types, it's much better now!

I also like using generics for API request/response code, ex: https://go.dev/play/p/OWf9eFmg1qF

With generics you don't need to return any/interface{} / type assert at runtime