Right now the generated assertions for some pointer types use valast.Addr to get an interface{} that then gets cast back into the desired type. It's quite a lot of casting around for certain types like *int32, which generates:
autogold.Expect(valast.Addr(int32(12)).(*int32)).Equal(...)
With generics, this can be:
func Addr[T any](v T) *T { return &v }
autogold.Expect(valast.Addr(int32(12))).Equal(...)
The improvement is nicer for simpler types, where before:
valast.Addr("device-1").(*string)
with generics:
Right now the generated assertions for some pointer types use
valast.Addrto get aninterface{}that then gets cast back into the desired type. It's quite a lot of casting around for certain types like*int32, which generates:With generics, this can be:
The improvement is nicer for simpler types, where before:
with generics: