diff --git a/tfmigrate/multi_state_migrator.go b/tfmigrate/multi_state_migrator.go index 6e05126..d11d9aa 100644 --- a/tfmigrate/multi_state_migrator.go +++ b/tfmigrate/multi_state_migrator.go @@ -2,11 +2,11 @@ package tfmigrate import ( "context" - "errors" "fmt" "log" "os" + "github.com/hashicorp/go-multierror" "github.com/minamijoyo/tfmigrate/tfexec" ) @@ -126,7 +126,7 @@ func (m *MultiStateMigrator) plan(ctx context.Context) (fromCurrentState *tfexec } // switch back it to remote on exit. defer func() { - err = errors.Join(err, fromSwitchBackToRemoteFunc()) + err = multierror.Append(err, fromSwitchBackToRemoteFunc()) }() // setup toDir. @@ -136,7 +136,7 @@ func (m *MultiStateMigrator) plan(ctx context.Context) (fromCurrentState *tfexec } // switch back it to remote on exit. defer func() { - err = errors.Join(err, toSwitchBackToRemoteFunc()) + err = multierror.Append(err, toSwitchBackToRemoteFunc()) }() // computes new states by applying state migration operations to temporary states. diff --git a/tfmigrate/state_migrator.go b/tfmigrate/state_migrator.go index bf8466b..2cf582b 100644 --- a/tfmigrate/state_migrator.go +++ b/tfmigrate/state_migrator.go @@ -2,11 +2,11 @@ package tfmigrate import ( "context" - "errors" "fmt" "log" "os" + "github.com/hashicorp/go-multierror" "github.com/minamijoyo/tfmigrate/tfexec" ) @@ -130,7 +130,7 @@ func (m *StateMigrator) plan(ctx context.Context) (currentState *tfexec.State, e // switch back it to remote on exit. defer func() { - err = errors.Join(err, switchBackToRemoteFunc()) + err = multierror.Append(err, switchBackToRemoteFunc()) }() // computes a new state by applying state migration operations to a temporary state.