Probably I'm missing something obvious from the docs but say I have two slices of structs that I want to compare but only on one field.
I want to write something like:
Expect(actual).To(HaveExactElements(
expected,
gstruct.MatchFields(gstruct.IgnoreExtra, Fields{"FieldName": Equal}),
))
But the values in Fields have to be already instantiated matchers. But what do I call Equal(??) with?
or something like
Expect(actual).To(HaveExactElements(expected, EqualOnFields("FieldName")))
I can see that HaveExactElements dynamically creates its default Equal() matcher from the expected elements but it wants a given custom matcher to already exist.
This is ultimately so painful because it's so painful to map values in go but it feels like this is something Gomega is in a good position to solve.
Probably I'm missing something obvious from the docs but say I have two slices of structs that I want to compare but only on one field.
I want to write something like:
But the values in
Fieldshave to be already instantiated matchers. But what do I callEqual(??)with?or something like
I can see that
HaveExactElementsdynamically creates its defaultEqual()matcher from the expected elements but it wants a given custom matcher to already exist.This is ultimately so painful because it's so painful to map values in go but it feels like this is something Gomega is in a good position to solve.