Skip to content

Commit

Permalink
hclwrite: No spaces before ... marker in argument lists or for exprs
Browse files Browse the repository at this point in the history
  • Loading branch information
apparentlymart committed May 15, 2019
1 parent d1ed8ee commit 4b22149
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
4 changes: 2 additions & 2 deletions hclwrite/format.go
Original file line number Diff line number Diff line change
Expand Up @@ -248,8 +248,8 @@ func spaceAfterToken(subject, before, after *Token) bool {
// Don't use spaces around attribute access dots
return false

case after.Type == hclsyntax.TokenComma:
// No space right before a comma in an argument list
case after.Type == hclsyntax.TokenComma || after.Type == hclsyntax.TokenEllipsis:
// No space right before a comma or ... in an argument list
return false

case subject.Type == hclsyntax.TokenComma:
Expand Down
4 changes: 4 additions & 0 deletions hclwrite/format_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,10 @@ func TestFormat(t *testing.T) {
`foo(1, -2,a*b, b,c)`,
`foo(1, -2, a * b, b, c)`,
},
{
`foo(a,b...)`,
`foo(a, b...)`,
},
{
`a="hello ${ name }"`,
`a = "hello ${name}"`,
Expand Down

0 comments on commit 4b22149

Please sign in to comment.