From 37b7e6ebceb21001d34d112957dbbcd7fedb9c65 Mon Sep 17 00:00:00 2001 From: Megan Bang Date: Tue, 30 Aug 2022 18:03:57 -0500 Subject: [PATCH] don't check diags for errors --- internal/command/import.go | 4 +--- internal/command/state_mv.go | 4 +--- internal/command/state_replace_provider.go | 4 +--- internal/command/state_rm.go | 4 +--- internal/command/taint.go | 4 +--- internal/command/untaint.go | 4 +--- 6 files changed, 6 insertions(+), 18 deletions(-) diff --git a/internal/command/import.go b/internal/command/import.go index d2a9917a85..28984d51f6 100644 --- a/internal/command/import.go +++ b/internal/command/import.go @@ -253,9 +253,7 @@ func (c *ImportCommand) Run(args []string) int { if isCloudMode(b) { var schemaDiags tfdiags.Diagnostics schemas, schemaDiags = c.MaybeGetSchemas(newState, nil) - if schemaDiags.HasErrors() { - diags = diags.Append(schemaDiags) - } + diags = diags.Append(schemaDiags) } // Persist the final state diff --git a/internal/command/state_mv.go b/internal/command/state_mv.go index da316d32a6..feb650ac88 100644 --- a/internal/command/state_mv.go +++ b/internal/command/state_mv.go @@ -398,9 +398,7 @@ func (c *StateMvCommand) Run(args []string) int { if isCloudMode(b) { var schemaDiags tfdiags.Diagnostics schemas, schemaDiags = c.MaybeGetSchemas(stateTo, nil) - if schemaDiags.HasErrors() { - diags = diags.Append(schemaDiags) - } + diags = diags.Append(schemaDiags) } // Write the new state diff --git a/internal/command/state_replace_provider.go b/internal/command/state_replace_provider.go index 75d9f05ef4..42fdc62559 100644 --- a/internal/command/state_replace_provider.go +++ b/internal/command/state_replace_provider.go @@ -173,9 +173,7 @@ func (c *StateReplaceProviderCommand) Run(args []string) int { if isCloudMode(b) { var schemaDiags tfdiags.Diagnostics schemas, schemaDiags = c.MaybeGetSchemas(state, nil) - if schemaDiags.HasErrors() { - diags = diags.Append(schemaDiags) - } + diags = diags.Append(schemaDiags) } // Write the updated state diff --git a/internal/command/state_rm.go b/internal/command/state_rm.go index f49081f4cd..77d4b1823b 100644 --- a/internal/command/state_rm.go +++ b/internal/command/state_rm.go @@ -123,9 +123,7 @@ func (c *StateRmCommand) Run(args []string) int { if isCloudMode(b) { var schemaDiags tfdiags.Diagnostics schemas, schemaDiags = c.MaybeGetSchemas(state, nil) - if schemaDiags.HasErrors() { - diags = diags.Append(schemaDiags) - } + diags = diags.Append(schemaDiags) } if err := stateMgr.WriteState(state); err != nil { diff --git a/internal/command/taint.go b/internal/command/taint.go index 859fa29920..e4da31d9b2 100644 --- a/internal/command/taint.go +++ b/internal/command/taint.go @@ -131,9 +131,7 @@ func (c *TaintCommand) Run(args []string) int { if isCloudMode(b) { var schemaDiags tfdiags.Diagnostics schemas, schemaDiags = c.MaybeGetSchemas(state, nil) - if schemaDiags.HasErrors() { - diags = diags.Append(schemaDiags) - } + diags = diags.Append(schemaDiags) } ss := state.SyncWrapper() diff --git a/internal/command/untaint.go b/internal/command/untaint.go index 1fd0e2eed7..d02a794cfe 100644 --- a/internal/command/untaint.go +++ b/internal/command/untaint.go @@ -170,9 +170,7 @@ func (c *UntaintCommand) Run(args []string) int { if isCloudMode(b) { var schemaDiags tfdiags.Diagnostics schemas, schemaDiags = c.MaybeGetSchemas(state, nil) - if schemaDiags.HasErrors() { - diags = diags.Append(schemaDiags) - } + diags = diags.Append(schemaDiags) } obj.Status = states.ObjectReady