GORM Playground Link
https://github.com/go-gorm/playground/pull/618
Description
Although gorm is based on Go 1.16 it appears to work with generics except where there is a many2many relationship. In this case, the field names parsed into reflect.StructOf (https://github.com/go-gorm/gorm/blob/master/schema/relationship.go#L320) are invalid because they include generic information:
User[Main.UserExt]ID
LanguageCode
User[Main.UserExt]Languages
In my original experiment I have also seen other characters such as / and %. If these names are sanitised before being passed to reflect.StructOf then in works and creates the tables. I have succeeded both by removing the [...] section or by just removing non-alpha-numeric characters.
I believe that if a fix can be put in to this relationship code it will allow gorm to be used with generics without having to raise the compatible version from 1.16.