Skip to content

Commit

Permalink
use multierror instead of errors.Join
Browse files Browse the repository at this point in the history
just a small fix to help with backwards compatibility for projects stuck on go < 1.20. This just postpones use of errors.Join in favour of multierror.Append. No functional changes.
  • Loading branch information
bharling committed Sep 22, 2023
1 parent fe82d85 commit 96d4350
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
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

0 comments on commit 96d4350

Please sign in to comment.