Skip to content

Commit

Permalink
migrate access request comparisons away from go-cmp
Browse files Browse the repository at this point in the history
  • Loading branch information
rosstimothy committed Oct 7, 2024
1 parent a6a0006 commit d8f563b
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 2 deletions.
5 changes: 5 additions & 0 deletions api/types/access_request.go
Original file line number Diff line number Diff line change
Expand Up @@ -598,6 +598,11 @@ func (s AccessReview) GetAccessListTitle() string {
return s.AccessList.Title
}

// IsEqual t is equivalent to the provide AccessReviewThreshold.
func (t *AccessReviewThreshold) IsEqual(o *AccessReviewThreshold) bool {
return deriveTeleportEqualAccessReviewThreshold(t, o)
}

// AccessRequestUpdate encompasses the parameters of a
// SetAccessRequestState call.
type AccessRequestUpdate struct {
Expand Down
10 changes: 10 additions & 0 deletions api/types/derived.gen.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 1 addition & 2 deletions lib/services/access_request.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ import (
"strings"
"time"

"github.com/google/go-cmp/cmp"
"github.com/google/uuid"
"github.com/gravitational/trace"
"github.com/jonboulle/clockwork"
Expand Down Expand Up @@ -1630,7 +1629,7 @@ func (c *thresholdCollector) pushThreshold(t types.AccessReviewThreshold) (uint3

// don't bother double-storing equivalent thresholds
for i, threshold := range c.Thresholds {
if cmp.Equal(t, threshold) {
if t.IsEqual(&threshold) {
return uint32(i), nil
}
}
Expand Down

0 comments on commit d8f563b

Please sign in to comment.