How to use Golang generics with structs

Learn how to create a generic struct to make the most of this feature

Tiago Temporin
ITNEXT
Published in
2 min readApr 8, 2022

--

Since Go 1.18, we finally have the power of generics. This week, while I was looking through the Golang source code, I found an example of how to create structs using generics.

In this post, I’ll show you how to do this.

--

--