Closed podtserkovskiy closed 7 years ago
On a second thought I'm removing the bug
label.
This is somewhat API issue here - NewWithPath does not return errors so you can't simply fail here if unexpected extension is detected (moreover the ifs could be improved to test for ".toml" instead of "toml" and so on).
Way of fixing this would be adding ErrorLoader and registering it when no valid extension is found, but it would change the behaviour the function currently has. And from the looks I think the silent failure is by design. 🤔
Hi, yes this is not a bug, where we are creating a default loader with the given filename with a best effort. If someone needs more granular work, could use MultiLoader and get the errors.
You can see more real-world usages here
configLoader := multiconfig.NewWithPath("1111") err := configLoader.Load(c)