-
-
Notifications
You must be signed in to change notification settings - Fork 19
valast: use generics instead of valast.Addr #42
Copy link
Copy link
Open
Description
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:
valast.Addr("device-1")Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels