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 force-pushed the from-toml-to-toml branch from 02391e8 to 83f0398 Compare January 23, 2024 18:54
@dangra dangra force-pushed the from-toml-to-toml branch from 02bcd90 to 74042e7 Compare January 23, 2024 19:23
@dangra dangra force-pushed the from-toml-to-toml branch from 39c3544 to 45f10ec Compare January 23, 2024 20:50
@dangra dangra force-pushed the from-toml-to-toml branch from cc71470 to 1428d14 Compare January 23, 2024 21:10
@dangra dangra force-pushed the from-toml-to-toml branch from 0f85178 to e487acd Compare January 23, 2024 21:36
@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