DEV Community

Limitations of Go generics

Chris Wendt on June 13, 2022

Go does not allow type parameters (generics) in method declarations, and that limits the APIs you can make. Here's an example when you might encou...
Collapse
 
programmermarvin profile image
Marvin

You can solve this by combining generics with interface within the connect method. This is more of a data issue and not implementation(generics) issue.

Collapse
 
chrismwendt profile image
Chris Wendt

Hmm, I don't follow. Got an example?