Question - Is ordering deterministic
- Dominant language
- Go
- Stars
- 5.8k
- Forks
- 657
- Avg merge
- 20h 36m
- Merged PRs (30d)
- 6
Description
Could you clarify whether hcl ordering is deterministic ? As we know, go maps are not deterministic in their output (i.e. you will get a different order each time).
Therefore, taking the README example:
```
process "main" {
command = ["/usr/local/bin/awesome-app", "server"]
}
process "mgmt" {
command = ["/usr/local/bin/awesome-app", "mgmt"]
}
```
And the readme definition:
```
type ServiceConfig struct {
Protocol string `hcl:"protocol,label"`
Type string `hcl:"type,label"`
ListenAddr string `hcl:"listen_addr"`
Processes []ProcessConfig `hcl:"process,block"`
}
type ProcessConfig struct {
Type string `hcl:"type,label"`
Command []string `hcl:"command"`
}
```
Will the output **_ALWAYS_** be as defined in the hcl config file ? i.e. `main` _**then**_ `mgmt` in this example.
The reason I am asking is because I am writing a playbook type Go app where the tasks need to be undertaken in a specific order otherwise _Bad Things Happen (TM)._ I am looking around for config tooling and `hcl` looks like it might tick many boxes as long as its output is deterministic.
Contributor guide
No contributing guide indexed for this repository
Research direction
Start with the README examples and the ServiceConfig and ProcessConfig definitions shown in the issue. Verify whether repeated process blocks preserve their source order during HCL decoding, then document the deterministic-ordering behavior and its implications for the example.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- go
- Domain
- documentation
- Issue type
- Documentation
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 30/100