From 63d288bac79d0ee57f0d0a4a9fc1922e196cfe01 Mon Sep 17 00:00:00 2001 From: Tomer Heber Date: Mon, 13 Jun 2022 19:40:57 -0500 Subject: [PATCH] hclwrite: fix data race modifying the internal "nilToken" variable This global variable is supposed to be treated as immutable. --- hclwrite/format.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/hclwrite/format.go b/hclwrite/format.go index 2b4ba323..dc7bc73e 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