From abf0284ca59a0bf5c2e0506c5ddd9629d7193793 Mon Sep 17 00:00:00 2001 From: Martin Atkins Date: Thu, 10 May 2018 17:22:32 -0700 Subject: [PATCH] tfdiags: Unwrap NonFatalError on append This is a variant of diagnosticsAsError that we use to signal to informed callers that there might just be warnings inside, but we should also do the right thing if a caller just appends it to an existing diagnostics without checking first. --- tfdiags/diagnostics.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tfdiags/diagnostics.go b/tfdiags/diagnostics.go index dc8a1b342..580f368ad 100644 --- a/tfdiags/diagnostics.go +++ b/tfdiags/diagnostics.go @@ -54,6 +54,8 @@ func (diags Diagnostics) Append(new ...interface{}) Diagnostics { diags = append(diags, ti...) // flatten case diagnosticsAsError: diags = diags.Append(ti.Diagnostics) // unwrap + case NonFatalError: + diags = diags.Append(ti.Diagnostics) // unwrap case hcl.Diagnostics: for _, hclDiag := range ti { diags = append(diags, hclDiagnostic{hclDiag})