From e609a8fa4c3a4586f2193bb829b9b7198506b430 Mon Sep 17 00:00:00 2001 From: Alex Pilon Date: Tue, 1 Dec 2020 16:59:27 -0500 Subject: [PATCH] Mirror diagnostic types terraform -json outputs --- tfexec/internal/e2etest/validate_test.go | 4 ++-- tfexec/validate_types.go | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/tfexec/internal/e2etest/validate_test.go b/tfexec/internal/e2etest/validate_test.go index f851eeb8..c00fa143 100644 --- a/tfexec/internal/e2etest/validate_test.go +++ b/tfexec/internal/e2etest/validate_test.go @@ -72,7 +72,7 @@ func TestValidate(t *testing.T) { Severity: "error", Summary: "Unsupported block type", Detail: "Blocks of type \"bad_block\" are not expected here.", - Range: tfexec.Range{ + Range: &tfexec.Range{ Filename: "main.tf", Start: tfexec.Pos{ Line: 1, @@ -88,7 +88,7 @@ func TestValidate(t *testing.T) { Severity: "error", Summary: "Unsupported argument", Detail: "An argument named \"bad_attribute\" is not expected here.", - Range: tfexec.Range{ + Range: &tfexec.Range{ Filename: "main.tf", Start: tfexec.Pos{ Line: 5, diff --git a/tfexec/validate_types.go b/tfexec/validate_types.go index 8035c10b..407a4284 100644 --- a/tfexec/validate_types.go +++ b/tfexec/validate_types.go @@ -11,10 +11,10 @@ type Validation struct { } type Diagnostic struct { - Severity string `json:"severity"` - Summary string `json:"summary"` - Detail string `json:"detail"` - Range Range `json:"range"` + Severity string `json:"severity,omitempty"` + Summary string `json:"summary,omitempty"` + Detail string `json:"detail,omitempty"` + Range *Range `json:"range,omitempty"` } type Range struct {