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

From toml to toml #3202

Merged
merged 9 commits into from
Jan 24, 2024
Merged

From toml to toml #3202

merged 9 commits into from
Jan 24, 2024

Conversation

dangra
Copy link
Member

@dangra dangra commented Jan 23, 2024

Change Summary

What and Why: While adding gpus to [[vm]] section, I found that BurntSushi/toml lib serializes zero values of integer fields even if omitempty tag is set for the struct field.

Sounds like a minor thing, but it is very awkward for fly.toml files created by fly launch whose [[vm]] section looks like:

[[vm]]
size = "shared-cpu-1x"
memory_mb  = 1024
gpus = 0

How: Unfortunately BurntSushi won't fix it and suggests using an integer pointer (*int instead of int), so the other alternative was to switch to https://github.com/pelletier/go-toml that works like we expect and claims to be more encoding/json alike.

As a big plus, this PR adds a test case to ensure reading a toml file and writing it back generates an equal configuration without missing sections nor new ones.

Related to:


Documentation

  • Fresh Produce
  • In superfly/docs, or asked for help from docs team
  • n/a

@dangra dangra marked this pull request as ready for review January 24, 2024 02:37
Copy link
Contributor

@billyb2 billyb2 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

banger pr 👍🏾

@dangra dangra merged commit 7e9c0f2 into master Jan 24, 2024
50 checks passed
@dangra dangra deleted the from-toml-to-toml branch January 24, 2024 17:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants