Skip to content

Commit 63d288b

Browse files
authored
hclwrite: fix data race modifying the internal "nilToken" variable
This global variable is supposed to be treated as immutable.
1 parent d0c4fa8 commit 63d288b

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

hclwrite/format.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ func formatSpaces(lines []formatLine) {
119119
if i < (len(line.lead) - 1) {
120120
after = line.lead[i+1]
121121
} else {
122-
after = nilToken
122+
continue
123123
}
124124
if spaceAfterToken(token, before, after) {
125125
after.SpacesBefore = 1
@@ -143,7 +143,7 @@ func formatSpaces(lines []formatLine) {
143143
if i < (len(line.assign) - 1) {
144144
after = line.assign[i+1]
145145
} else {
146-
after = nilToken
146+
continue
147147
}
148148
if spaceAfterToken(token, before, after) {
149149
after.SpacesBefore = 1

0 commit comments

Comments
 (0)