summaryrefslogtreecommitdiff
path: root/hclwrite
diff options
context:
space:
mode:
authorTomer Heber <heber.tomer@gmail.com>2022-06-13 19:40:57 -0500
committerGitHub <noreply@github.com>2022-06-13 17:40:57 -0700
commit63d288bac79d0ee57f0d0a4a9fc1922e196cfe01 (patch)
tree12824ed6809437d0cf2c481dd24a4b8b1069d2cf /hclwrite
parentd0c4fa8b0bbc2e4eeccd1ed2a32c2089ed8c5cf1 (diff)
hclwrite: fix data race modifying the internal "nilToken" variable
This global variable is supposed to be treated as immutable.
Diffstat (limited to 'hclwrite')
-rw-r--r--hclwrite/format.go4
1 files changed, 2 insertions, 2 deletions
diff --git a/hclwrite/format.go b/hclwrite/format.go
index 2b4ba32..dc7bc73 100644
--- a/hclwrite/format.go
+++ b/hclwrite/format.go
@@ -119,7 +119,7 @@ func formatSpaces(lines []formatLine) {
if i < (len(line.lead) - 1) {
after = line.lead[i+1]
} else {
- after = nilToken
+ continue
}
if spaceAfterToken(token, before, after) {
after.SpacesBefore = 1
@@ -143,7 +143,7 @@ func formatSpaces(lines []formatLine) {
if i < (len(line.assign) - 1) {
after = line.assign[i+1]
} else {
- after = nilToken
+ continue
}
if spaceAfterToken(token, before, after) {
after.SpacesBefore = 1