From 265bbba55cb85b53eea542defc57e854110ad084 Mon Sep 17 00:00:00 2001 From: Gabriele Gerbino Date: Mon, 18 Mar 2024 21:23:06 +0100 Subject: [PATCH] fix: sort endpoint_permissions when computing diffs --- pkg/state/types.go | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/pkg/state/types.go b/pkg/state/types.go index 8328eae..6abdd1a 100644 --- a/pkg/state/types.go +++ b/pkg/state/types.go @@ -1516,6 +1516,14 @@ func (r1 *RBACEndpointPermission) EqualWithOpts(r2 *RBACEndpointPermission, igno r2Copy.CreatedAt = nil } + sort.Slice(r1Copy.Actions, func(i, j int) bool { + return *r1Copy.Actions[i] < *r1Copy.Actions[j] + }) + + sort.Slice(r2Copy.Actions, func(i, j int) bool { + return *r2Copy.Actions[i] < *r2Copy.Actions[j] + }) + return reflect.DeepEqual(r1Copy, r2Copy) }