Expected behavior (what you expected to happen): Unquoted TOML entries with a dot should be read properly:
[section1]
la.la="one"
[section2]
"la.la"="two"
section1.la.la
should read one
.
Actual behavior (what actually happened):
Only section2.la.la
will be available, not section1.la.la
contrary to the TOML definition.
Repl.it link:
https://replit.com/@gregszabo/TOMLExample3
Code reproducing the issue:
package main
import (
"bytes"
"fmt"
"github.com/spf13/viper"
)
func main() {
var tomlExample1 = []byte(`
[something]
la="one"
`)
var tomlExample2 = []byte(`
[something]
la.la="two"
`)
var tomlExample3 = []byte(`
[something]
"la.la"="three"
`)
viper.SetConfigType("toml")
viper.ReadConfig(bytes.NewBuffer(tomlExample1))
fmt.Printf("%v\n",viper.AllKeys())
viper.ReadConfig(bytes.NewBuffer(tomlExample2))
fmt.Printf("%v\n",viper.AllKeys())
viper.ReadConfig(bytes.NewBuffer(tomlExample3))
fmt.Printf("%v\n",viper.AllKeys())
// From https://toml.io/en/v1.0.0#keys
// Dotted keys are a sequence of bare or quoted keys joined with a dot. This allows for grouping similar properties together
// Output:
// [something.la]
// []
// [something.la.la]
// Expected output:
// [something.la]
// [something.la.la]
// [something.la.la]
}
Environment: - Viper version: v1.7.1 - Config source: file - File format: TOML
Anything else we should know?:
Comment From: github-actions[bot]
👋 Thanks for reporting!
A maintainer will take a look at your issue shortly. 👀
In the meantime: We are working on Viper v2 and we would love to hear your thoughts about what you like or don't like about Viper, so we can improve or fix those issues.
⏰ If you have a couple minutes, please take some time and share your thoughts: https://forms.gle/R6faU74qPRPAzchZ9
📣 If you've already given us your feedback, you can still help by spreading the news, either by sharing the above link or telling people about this on Twitter:
https://twitter.com/sagikazarmark/status/1306904078967074816
Thank you! ❤️
Comment From: github-actions[bot]
Issues with no activity for 30 days are marked stale and subject to being closed.