fix: allow unused keys in hasher config (#6724)

This commit is contained in:
Tim Möhlmann 2023-10-13 16:11:20 +03:00 committed by GitHub
parent 95889cf576
commit 0af1c65c4c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 2 deletions

View File

@ -147,7 +147,7 @@ func (c *HasherConfig) buildHasher() (hasher passwap.Hasher, prefixes []string,
func (c *HasherConfig) decodeParams(dst any) error { func (c *HasherConfig) decodeParams(dst any) error {
decoder, err := mapstructure.NewDecoder(&mapstructure.DecoderConfig{ decoder, err := mapstructure.NewDecoder(&mapstructure.DecoderConfig{
ErrorUnused: true, ErrorUnused: false,
ErrorUnset: true, ErrorUnset: true,
Result: dst, Result: dst,
}) })

View File

@ -379,7 +379,10 @@ func TestHasherConfig_decodeParams(t *testing.T) {
"b": 2, "b": 2,
"c": 3, "c": 3,
}, },
wantErr: true, want: dst{
A: 1,
B: 2,
},
}, },
{ {
name: "unset", name: "unset",