Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

use multierror instead of errors.Join #153

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions tfmigrate/multi_state_migrator.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@ package tfmigrate

import (
"context"
"errors"
"fmt"
"log"
"os"

"github.com/hashicorp/go-multierror"
"github.com/minamijoyo/tfmigrate/tfexec"
)

Expand Down Expand Up @@ -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.
Expand All @@ -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.
Expand Down
4 changes: 2 additions & 2 deletions tfmigrate/state_migrator.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@ package tfmigrate

import (
"context"
"errors"
"fmt"
"log"
"os"

"github.com/hashicorp/go-multierror"
"github.com/minamijoyo/tfmigrate/tfexec"
)

Expand Down Expand Up @@ -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.
Expand Down
Loading