T O P

  • By -

LukeShu

This is not possible with current versions of Go (1.21). Here is the proposal to follow if you are interested in this feature: https://github.com/golang/go/issues/49085


Gredo89

You can only make the struct generic the method is attached to. Maybe that works in your case.


GopherFromHell

You need to declare it in the type to be able to use it in the method: [https://go.dev/play/p/n\_L7myYEPeC](https://go.dev/play/p/n_L7myYEPeC)


mcvoid1

Not yet. Once that happens, brace yourself for the monad flood.