| 1037 | } |
| 1038 | |
| 1039 | func (v *Viper) UnmarshalExact(rawVal any, opts ...DecoderConfigOption) error { |
| 1040 | config := v.defaultDecoderConfig(rawVal, opts...) |
| 1041 | config.ErrorUnused = true |
| 1042 | |
| 1043 | keys := v.AllKeys() |
| 1044 | |
| 1045 | if v.experimentalBindStruct { |
| 1046 | // TODO: make this optional? |
| 1047 | structKeys, err := v.decodeStructKeys(rawVal, opts...) |
| 1048 | if err != nil { |
| 1049 | return err |
| 1050 | } |
| 1051 | |
| 1052 | keys = append(keys, structKeys...) |
| 1053 | } |
| 1054 | |
| 1055 | // TODO: struct keys should be enough? |
| 1056 | return decode(v.getSettings(keys), config) |
| 1057 | } |
| 1058 | |
| 1059 | // BindPFlags binds a full flag set to the configuration, using each flag's long |
| 1060 | // name as the config key. |