Skip to content

Commit 390e471

Browse files
committed
Fix error comparisons
1 parent f380640 commit 390e471

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

internal/backend/testing.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ func TestBackendStates(t *testing.T, b Backend) {
8080

8181
noDefault := false
8282
if _, sDiags := b.StateMgr(DefaultStateName); sDiags.HasErrors() {
83-
if sDiags.Err() == ErrDefaultWorkspaceNotSupported {
83+
if sDiags.Err().Error() == ErrDefaultWorkspaceNotSupported.Error() {
8484
noDefault = true
8585
} else {
8686
t.Fatalf("error: %v", sDiags.Err())

internal/command/meta_backend_migrate.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -282,7 +282,7 @@ func (m *Meta) backendMigrateState_s_s(opts *backendMigrateOpts) error {
282282

283283
var err error
284284
destinationState, sDiags := opts.Destination.StateMgr(opts.destinationWorkspace)
285-
if sDiags.Err().Error() == backend.ErrDefaultWorkspaceNotSupported.Error() {
285+
if sDiags.HasErrors() && sDiags.Err().Error() == backend.ErrDefaultWorkspaceNotSupported.Error() {
286286
// If the backend doesn't support using the default state, we ask the user
287287
// for a new name and migrate the default state to the given named state.
288288
destinationState, err = func() (statemgr.Full, error) {

0 commit comments

Comments
 (0)