Open donglinjy opened 11 months ago
Hi @donglinjy, thanks for reporting the issue. Yeah, the root of the issue is that the Golang text scanner parses as you described ('2.2.0' into '2.2' and '.0'). I'll look for a solution. In the meantime, you can use double quotes
key1 {
a = "a"
b = "2.2.0"
"c-f1.2g" = "ok"
}
Hi @donglinjy, thanks for reporting the issue. Yeah, the root of the issue is that the Golang text scanner parses as you described ('2.2.0' into '2.2' and '.0'). I'll look for a solution. In the meantime, you can use double quotes
key1 { a = "a" b = "2.2.0" "c-f1.2g" = "ok" }
Thanks. Based on what I tried, to work around it, for the issue in value like 2.2.0, we can double quote it. But for key like c-f1.2g
, will need to quote each parts split by .
as blow, or the config loading will succeed, but it won't allow you to read config like GetString("key1.c-f1.2g")
.
a = "a"
b = "2.2.0"
"c-f1"."2g" = "ok"
}
You're right, I didn't realize 'c-f1.2g' is nested, thought of it as a single key. In fact you can also just double quote the last part like c-f1."2g"
I will fail to load string configure as below, with error
error while parsing configuration: missing comma! at: 4:13, values should have comma or ASCII newline ('\n') between them
.The root cause may be because text scanner will parse
2.2.0
into2.2
and.0
, and will parsec-f1.2g
intoc-f1
,.2
, andg
.