-1

I was looking for a configuration parser for go and https://github.com/spf13/viper seems to come highly recommended.

I am very surprised to find that configuration files are not validated by default. Viper parses files and extracts requested values from them but I cannot find a way to detect bad configuration.

For instance I if create a (Java style) .properties file containing just "???" and nothing else. This is accepted without any error.

I can understand the philosophy that you should ignore irrelevant configuration items but I desire more rigor. I would also like to reject anything that does not match the X=Y format in a properties file.

To me this is a fatal flaw that suggests I should use a different package (or roll my own as usual).

Have I missed something? Does viper in fact support detecting and rejecting bad configuration keys?

4

1 回答 1

0

我认为答案是否定的。viper 不验证 java .properties 文件。我将错误报告(或功能请求,取决于您的观点)发布为https://github.com/spf13/viper/issues/790

于 2019-11-04T03:23:23.670 回答