-
Notifications
You must be signed in to change notification settings - Fork 213
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
Ordered-Marshal doesn't give the correct order and in certain cases duplicates the path after using SetPath #450
Comments
There's currently a bug (pelletier/go-toml#450) in the toml library proji is using and its affecting our package export. In some cases the name field of a package is missing and sometimes its duplicate. The problem is backtrackable to the order command which makes it so packages exports always look the same and in their intended order. Until the fix is out we'll just take out the order command. Export works fine; just isn't ordered anymore as originally wanted.
Thank you for reporting this! Definitely seems wrong. |
Hey, I think I have a fix for this, I am just refactoring the code and testing it once more. My code will also fix this issue: |
here is a much simpler example that reproduces the duplication bug: https://play.golang.org/p/FN1Jc33D4PF not sure if this is the same issue. happy to open another one if it's not the case. The problem seems to be related to the string map in my example. it works if i remove replace that with a string for example. |
Encoding has serious problems that cause keys beeing duplicated or overwritten: pelletier/go-toml#450
@fiws thank you for the simplified repro! I likely won't try to fix it in v1 given all my time is focused on v2. Fortunately |
Hey dear @heyaWorld and @fiws, can you try if #539 fixes your problems? |
encoding bugs seem fixed. pelletier/go-toml#450 (comment)
Describe the bug
NewEncoder(w io.Writer).Order(OrderPreserve).Encode(v interface{})
doesn't return the correct ordered output and in certain cases duplicates the path set by (*Tree).SetPath()To Reproduce
Expected behavior
[inputs.cpu.tags]
should not be duplicate."collect_cpu_time = false"
is missing under the inputs.cpu table.Original Ordered output after running the above code:
Expected ordered output:
Another example(If we change the config variable in the reproduce step to this):
Original Ordered output after running the above code:
Expected ordered output:
collect_cpu_time = false
should come before the[inputs.cpu.tags]
Also compared to example 1, there is no duplication in this case.Versions
Additional context
The text was updated successfully, but these errors were encountered: