Skip to content

Commit

Permalink
hclwrite: fix data race modifying the internal "nilToken" variable
Browse files Browse the repository at this point in the history
This global variable is supposed to be treated as immutable.
  • Loading branch information
TomerHeber authored Jun 14, 2022
1 parent d0c4fa8 commit 63d288b
Showing 1 changed file with 2 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 @@ -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
Expand All @@ -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
Expand Down

0 comments on commit 63d288b

Please sign in to comment.