This commit is contained in:
Afshin Mehrabani 2025-03-28 19:52:08 +00:00 committed by GitHub
commit 55c969ac76
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -1494,6 +1494,13 @@ func (v *Viper) ReadInConfig() error {
v.logger.Debug("reading file", "file", filename) v.logger.Debug("reading file", "file", filename)
file, err := afero.ReadFile(v.fs, filename) file, err := afero.ReadFile(v.fs, filename)
if err != nil { if err != nil {
fileExt := filepath.Ext(filename)
if stringInSlice(fileExt, SupportedExts) {
log.Println("warning:", "Looks like you have included the file extention in the file name."+
"Consider using SetConfigType method instead.")
}
return err return err
} }