Closed coventry closed 3 years ago
That would have been my expectation, too, but there's a test which explicitly checks that a key which doesn't match fields is silently ignored. I can see arguments for it going either way, especially now that the liberal version is in widespread use.
Oh, and thanks for testing it!
Looks good, but I think I will refactor the use of pkg/errors so that the base library does not have transient dependencies
These behave the same as Struct/StructPtr, except that they panic unless the keys in the
gens
map exactly match the fields onrt
(i.e. gens must specify generators for all fields.)If passed an extra
true
argument, they allowgens
to leave generators for some fields unspecified. They still panic unless the keys in gens all correspond to fields onrt
. In this case, the generated values will have the zero value for any field which is left unspecified ingens
.