#1777·viper

Unclear doc

Author: jsumnersCreated Mar 3, 2024Updated Feb 18, 2026
Labelskind/buglifecycle/keep

https://github.com/spf13/viper/blob/5870123c5f385c8d88b7087d15d2e1b7fa67a7fa/README.md?plain=1#L144

That line of the readme is a bit confusing. It took navigating the git blame history to find https://github.com/spf13/viper/commit/9cd571279d195d6a02b5103f0301d8310dd4338d and reviewing the commit in context for me to understand that it is saying a file named ~/.foo can be loaded as YAML when viper.SetConfigType("yaml") is used.

I was looking for a way to support the following file path possibilities:

  • /etc/foo/config.yaml
  • $HOME/.foo
  • $HOME/.foo.yaml
  • ./.foo
  • ./.foo.yaml

It's still not clear to me if I can support that list.