hashicorp / hashicorp/hcl

Formatting of single-line objects includes extra newlines

Open
#204 0 comments 0 reactions 0 assignees View on GitHub
v1
Dominant language
Go
Stars
5.8k
Forks
659
Avg merge
20h 36m
Merged PRs (30d)
6

Description

### HCL Template
```hcl
test1 = { key = "environment", value = "${terraform.env}" }

test2 = {
key = "environment",
value = "${terraform.env}",
}
```

### Expected behavior
Both objects are formatted the same.

### Actual behavior
```
$ hclfmt test.hcl
test1 = {
key = "environment"

value = "${terraform.env}"
}

test2 = {
key = "environment"
value = "${terraform.env}"
}
```

Contributor guide

No contributing guide indexed for this repository

Research direction

Start with the inline HCL examples and reproduce the result using the hclfmt test.hcl command shown in the issue. Trace the formatter behavior for single-line and multiline objects; done means both inputs receive consistent formatting without the extra blank line.

Written by the indexing model from the issue text.

Assessment

Tech stack
go
Domain
tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.