Skip to content

Commit

Permalink
[backend] Fix dependency sorting in mustWrite (#15974)
Browse files Browse the repository at this point in the history
Just use slices.Sort instead of sort.Slice.

---------

Co-authored-by: Thomas Gummerer <t.gummerer@gmail.com>
  • Loading branch information
pgavlin and tgummerer committed Apr 18, 2024
1 parent f6b405c commit 64bee7d
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
changes:
- type: fix
scope: backend
description: Fix incorrect dependency sorting in snapshot
5 changes: 3 additions & 2 deletions pkg/backend/snapshot.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,10 @@ import (
"errors"
"fmt"
"reflect"
"sort"
"time"

"golang.org/x/exp/slices"

"github.com/pulumi/pulumi/pkg/v3/engine"
"github.com/pulumi/pulumi/pkg/v3/resource/deploy"
"github.com/pulumi/pulumi/pkg/v3/secrets"
Expand Down Expand Up @@ -271,7 +272,7 @@ func (ssm *sameSnapshotMutation) mustWrite(step *deploy.SameStep) bool {
sortDeps := func(deps []resource.URN) []resource.URN {
result := make([]resource.URN, len(deps))
copy(result, deps)
sort.Slice(result, func(i, j int) bool { return deps[i] < deps[j] })
slices.Sort(result)
return result
}
oldDeps := sortDeps(old.Dependencies)
Expand Down

0 comments on commit 64bee7d

Please sign in to comment.