-
-
Notifications
You must be signed in to change notification settings - Fork 378
Generics
Dominik Honnef edited this page Sep 11, 2024
·
7 revisions
Collection of links and notes collected while updating Staticcheck to support type parameters (generics). These are mostly gotchas and expert explanations that cleared up my confusion.
- Methods on generic types need special considerations when consuming go/types.Info: https://github.com/golang/go/issues/51184
- Interfaces are abstract types that define type sets, and the meaning of being
comparable
: griesemer's replies in https://github.com/golang/go/issues/50646 - Type parameters are interfaces: https://go-review.googlesource.com/c/go/+/359016/
- Helper package for analyzing generics and maintaining compatibility with Go 1.17: https://pkg.go.dev/golang.org/x/exp/typeparams
- Go 1.18 will likely be more restrictive than future versions with regard to permitted uses of generics