You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This PR changes the TOML library from `pelletier/go-toml/v2` to
`BurntSushi/toml`. This improves the formatting of TOML files by using
indents and also uses `time.Duration`'s string values instead of writing
nanoseconds into the config file.
### Config format example
Before:
```toml
active_context = 'test_context'
[preferences]
debug = true
poll_interval = 1234000000
[[contexts]]
name = 'test_context'
token = 'super secret token'
[contexts.preferences]
array_option = ['1', '2', '3']
endpoint = 'https://test-endpoint.com'
quiet = true
[contexts.preferences.nested]
array_option = ['1', '2', '3']
[[contexts]]
name = 'other_context'
token = 'another super secret token'
[contexts.preferences]
poll_interval = 1234000000
```
After:
```toml
active_context = "test_context"
[preferences]
debug = true
poll_interval = "1.234s"
[[contexts]]
name = "test_context"
token = "super secret token"
[contexts.preferences]
array_option = ["1", "2", "3"]
endpoint = "https://test-endpoint.com"
quiet = true
[contexts.preferences.nested]
array_option = ["1", "2", "3"]
[[contexts]]
name = "other_context"
token = "another super secret token"
[contexts.preferences]
poll_interval = "1.234s"
```
Contexts are now grouped together instead of there being exactly one
newline between every section, regardless of being in another context or
not. Also, nested sections are now indented, which helps with
understanding the structure.
### Binary size
Before:
```
➜ cli git:(21e342b) GOARCH=amd64 GOOS=linux go build -o hcloud cmd/hcloud/main.go
➜ cli git:(21e342b) wc -c hcloud
20606086 hcloud
```
After:
```
➜ cli git:(d336765) GOARCH=amd64 GOOS=linux go build -o hcloud cmd/hcloud/main.go
➜ cli git:(d336765) wc -c hcloud
20890490 hcloud
```
The binary size increases by ~1.4%, which is negligible.
0 commit comments