Skip to content
This repository has been archived by the owner on Sep 9, 2020. It is now read-only.

Always use trailing newlines in multi line arrays #1595

Closed
vektah opened this issue Jan 29, 2018 · 6 comments
Closed

Always use trailing newlines in multi line arrays #1595

vektah opened this issue Jan 29, 2018 · 6 comments

Comments

@vektah
Copy link

vektah commented Jan 29, 2018

#1461 switched to using multi line toml arrays in the lock file, while this improved readability it also introduced some additional diff churn.

Before:

- packages = [".","a"]
+ packages = [".","a","b"]

After:

packages = [
    "."
-   "a"
+   "a",
+   "b"
]

This is bad because it increases the chance of merge conflicts in the lock and decreases readability. It was also one of the reasons toml was chosen over a more mainstream format like json.

Proposal: Always add trailing commas, just like in go. This probably requires an upstream change to the toml library.

@sdboyer
Copy link
Member

sdboyer commented Jan 29, 2018

i don't actually know if TOML allows trailing commas, but if it does, this seems like a clear win.

but yeah, it'll be a todo for our TOML lib - /cc @pelletier

@pelletier
Copy link

pelletier commented Jan 29, 2018 via email

@ctd1500
Copy link

ctd1500 commented Mar 1, 2018

Trailing commas are now implemented in the TOML library: pelletier/go-toml#217

@sdboyer-stripe
Copy link

sweet! thanks @ctd1500. we'll get this incorporated as soon as there's a new go-toml release 😄

@pelletier
Copy link

Released go-toml 1.2.0 https://github.com/pelletier/go-toml/releases/tag/v1.2.0 for that

@sdboyer
Copy link
Member

sdboyer commented Jun 5, 2018

thank you!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants