Hacker Newsnew | past | comments | ask | show | jobs | submit | _256's commentslogin

I don't care that much about defining a minimal interface or whether the producer or consumer defines it. the pain point for me is when you start passing interfaces up and down the stack and they become impossible to trace back to the concrete type. If you take an interface you should use it directly and avoid passing it down to another one of your dependencies. This keeps the layers you need to jump through to find the concrete type to a minimum.



This is a simple LRU cache I made to get my hands on generics which is available in the go 1.18 beta. Feedback is welcome :-)


Might you or anyone else have any good links or references that helped you come up to speed on generics in Go?


The tutorial from the Go team is pretty good to learn the basics: https://go.dev/doc/tutorial/generics


There's also the type parameters proposal document which covers a lot of ground.

https://go.googlesource.com/proposal/+/refs/heads/master/des...


Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: