Skip to content
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

Panic when value is missing #732

Closed
TomWright opened this issue Jan 4, 2022 · 4 comments · Fixed by #733
Closed

Panic when value is missing #732

TomWright opened this issue Jan 4, 2022 · 4 comments · Fixed by #733
Labels
bug Issues describing a bug in go-toml.

Comments

@TomWright
Copy link

Describe the bug
I received a bug report on my project and it seems to be an upstream issue from this project.

TomWright/dasel#191

To Reproduce
Parsing the given toml will panic.

[test]
something =
foo = "bar"

Expected behavior
A clear and concise description of what you expected to happen, if other than "should work".

Versions

  • go-toml: v1.9.3
  • go: 1.17
  • operating system: Host: ultima-jd-pc Kernel: 5.10.79-1-MANJARO x86_64 bits: 64 Desktop: GNOME 41.1 Distro: Manjaro Linux
moorereason added a commit to moorereason/go-toml that referenced this issue Jan 4, 2022
@pelletier pelletier added the bug Issues describing a bug in go-toml. label Jan 5, 2022
pelletier pushed a commit that referenced this issue Jan 5, 2022
@pelletier
Copy link
Owner

Should be fixed by fed1464 from @moorereason.

After a quick look to https://github.com/TomWright/dasel it seems like you're only using toml.Unmarshal and toml.Encoder. If you're keen I'd encourage you to try out go-toml/v2: https://github.com/pelletier/go-toml/tree/v2. It's faster, less buggy, and should be released to stable soon.

@TomWright
Copy link
Author

Thanks for the quick fix!

I'd be happy to upgrade to v2 as soon as it's stable 🙂

@pelletier
Copy link
Owner

@TomWright go-toml v2.0.0 has been released! – https://github.com/pelletier/go-toml/releases/tag/v2.0.0

@TomWright
Copy link
Author

Thank you very much 😁

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Issues describing a bug in go-toml.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants