Closed akhilerm closed 1 year ago
This is a actually a TOML issue. In this format, indentation doesn't mean anything. In your second example, the document looks like this:
project_name="containerd"
[override_deps]
[override_deps."github.com/containerd/log"]
previous="github.com/containerd/containerd"
previous="v1.26.4"
In TOML, all keys defined after a table belong to that table, until end of file or the next table. So in this case, the table override_deps."github.com/containerd/log"
does indeed have the key previous
twice.
Got it. Thank you for the explanation. I will proceed with closing the issue.
Describe the bug When there are 2 keys with same name, one inside a table and one outside, based on the order of the outer key , the parsing will pass or fail. If the outer key is written immediately after the table, the parsing fails.
To Reproduce Consider the following struct definition
If the toml is as follows, the parsing works as expected
But if the order is changed in the toml file, then parsing fails with error
toml: key previous is already defined
Expected behavior Irrespective of where the key
previous
is present in the outer table, the parsing should succeed.Versions
Additional context Add any other context about the problem here that you think may help to diagnose.