-
Notifications
You must be signed in to change notification settings - Fork 5.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Seeing "invalid TOML syntax" for valid TOML #10534
Comments
I consider BurntSushi/toml the canonical source, this does appear to work and it is valid TOML syntax: package main
import (
"fmt"
"log"
"github.com/BurntSushi/toml"
)
var tomlData = `
array = [
# hello I am a comment
"hello",
"world"
]
`
type tomlConfig struct {
Array []string `toml:"array"`
}
func main() {
var conf tomlConfig
if _, err := toml.Decode(tomlData, &conf); err != nil {
log.Fatal(err)
}
fmt.Println(conf)
} $ go build && ./test
{[hello world]} However, we use the https://github.com/influxdata/toml library to parse TOML files. This is really a fork of https://github.com/naoina/toml. I am able to reproduce the invalid TOML syntax with the last release of both libraries:
However, once I upgrade the library to master it is able to parse the TOML:
It looks like we are missing naoina/toml@605f287 this commit for comments in arrays. Next steps: look to update our fork with the missing commit or commits from the https://github.com/naoina/toml library |
Looks like this is a duplicate of: #3642, I went ahead and closed #3642 in favor of this one because I think this issue has more information to help resolve the problem. It would be nice if we could switch to BurntSushi/toml, from the comments in #3642 and #6474 it seems this was the intention at some point. |
Relevent telegraf.conf
Logs from Telegraf
invalid TOML syntax
System info
master branch telegraf
Docker
No response
Steps to reproduce
check out my fork here: https://github.com/lorenmh/telegraf
run
go test ./config/...
diff here: lorenmh@7e44c12
Expected behavior
This is valid TOML and it should be parsed correctly
Actual behavior
Parse fails, Telegraf won't run
Additional info
No response
The text was updated successfully, but these errors were encountered: