I would say it's when you're looking at a profile of your program and notice that you're bottlenecked on interface{} things.
People complain about casting interface{} and type safety but I've probably written hundreds of thousands of lines of Go over many years and I can't remember ever seeing a bug from that. You do it once, in one place, and never think about it again.
Re:Constraints in Go
by cherryteastain on Sunday November 17, 2024 @03:56PM
(#42167163)
I mostly agree, hence the
> end up copy pasting code instead
bit of my original comment
You should convert when you reach the point "I wish I had that code but with this other type". Even then, sometimes interfaces are the right answer, rather than generics.