From 3c0fafde46d5de3ed8c0b2b71602bd9d04ac0d62 Mon Sep 17 00:00:00 2001 From: Martin Atkins Date: Sat, 14 Jul 2018 15:01:41 -0700 Subject: [PATCH] hclwrite: Formatter should put a space after a comma --- hclwrite/format.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/hclwrite/format.go b/hclwrite/format.go index d9235ec..656f86f 100644 --- a/hclwrite/format.go +++ b/hclwrite/format.go @@ -239,6 +239,10 @@ func spaceAfterToken(subject, before, after *Token) bool { // No space right before a comma in an argument list return false + case subject.Type == hclsyntax.TokenComma: + // Always a space after a comma + return true + case subject.Type == hclsyntax.TokenQuotedLit || subject.Type == hclsyntax.TokenStringLit || subject.Type == hclsyntax.TokenOQuote || subject.Type == hclsyntax.TokenOHeredoc || after.Type == hclsyntax.TokenQuotedLit || after.Type == hclsyntax.TokenStringLit || after.Type == hclsyntax.TokenCQuote || after.Type == hclsyntax.TokenCHeredoc: // No extra spaces within templates return false