-
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
Is there a good way to modify a toml file? #457
Comments
Unfortunately not yet. As far as I know the best you can do today is to decide that the file should always be "linted" and have go-toml sort it on write. Edit-in-place is definitely something I would love to see as well. Most of the pieces are already there: |
@pelletier, thanks for reply. Any plans to support "Edit-in-place"? |
Not personally -- my free time has been close to non-existent lately, as the delay in this reply shows. If anyone wants to tackle this I'll happily review pull requests. |
I am also looking for this feature. We want to edit some keys or add new keys through programmatically. |
Thanks for your interest in go-toml! I'm currently working (albeit slowly) on defining the document editing interface for go-toml v2. It should address this issue. If you have ideas or examples of what you'd like it to look like I'd love to see them! |
Closing this issue, as go-toml v2.0.0 has been released, and document manipulation is out of scope for v2. As go-toml v1 will not be receiving any updates, please look into upgrading to the new version. If you believe this is a mistake please reach out! |
Is there a good way to modify a toml file? I just have to modify the value of some keys. And I would like to just keep all the other things unchanged, such as the order of the keys and the comments. It seems it can be achieved by LoadFile and then set the new value and call WriteTo to overwrite the toml file, but the original layout like the order of the keys and the comments will be lost.
The text was updated successfully, but these errors were encountered: