From 2934d2f0331a78c73667961dac9002a2de8da789 Mon Sep 17 00:00:00 2001 From: Martin Atkins Date: Fri, 14 Dec 2018 11:33:28 -0800 Subject: [PATCH] cmd/hclspecsuite: Generate correct ranges in diagnostic-diagnostics We were taking a pointer to a for loop iterator variable and thus capturing the final iteration value rather than each one separately. By using the .Ptr() method instead, we force a copy of the range which we then take a pointer to. --- cmd/hclspecsuite/runner.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cmd/hclspecsuite/runner.go b/cmd/hclspecsuite/runner.go index 4810454..b5a309c 100644 --- a/cmd/hclspecsuite/runner.go +++ b/cmd/hclspecsuite/runner.go @@ -283,7 +283,7 @@ func (r *Runner) runTestInput(specFilename, inputFilename string, tf *TestFile) "No %s diagnostic was expected %s. The unexpected diagnostic was shown above.", severityString(gotEntry.Severity), rangeString(gotEntry.Range), ), - Subject: &gotEntry.Range, + Subject: gotEntry.Range.Ptr(), }) } } @@ -297,7 +297,7 @@ func (r *Runner) runTestInput(specFilename, inputFilename string, tf *TestFile) "No %s diagnostic was generated %s.", severityString(wantEntry.Severity), rangeString(wantEntry.Range), ), - Subject: &declRange, + Subject: declRange.Ptr(), }) } }