From bb4b6fcd2114f9eaeb6746334540cbbe4c4c06b7 Mon Sep 17 00:00:00 2001 From: Matt Brock Date: Tue, 7 Jan 2025 14:21:11 -0600 Subject: [PATCH] Removing ptrToList --- .../fetchers/azure-sync/roledefinitions.go | 15 +++------------ 1 file changed, 3 insertions(+), 12 deletions(-) diff --git a/lib/srv/discovery/fetchers/azure-sync/roledefinitions.go b/lib/srv/discovery/fetchers/azure-sync/roledefinitions.go index dc6a0a48e752f..529d0f2070c9c 100644 --- a/lib/srv/discovery/fetchers/azure-sync/roledefinitions.go +++ b/lib/srv/discovery/fetchers/azure-sync/roledefinitions.go @@ -21,6 +21,7 @@ package azuresync import ( "context" "fmt" //nolint:golint // used in a dependent PR + "github.com/gravitational/teleport/lib/utils/slices" "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/authorization/armauthorization/v2" "github.com/gravitational/trace" @@ -59,8 +60,8 @@ func fetchRoleDefinitions(ctx context.Context, subscriptionID string, cli RoleDe continue } pbPerm := accessgraphv1alpha.AzureRBACPermission{ - Actions: ptrsToList(perm.Actions), - NotActions: ptrsToList(perm.NotActions), + Actions: slices.FromPointers(perm.Actions), + NotActions: slices.FromPointers(perm.NotActions), } pbPerms = append(pbPerms, &pbPerm) } @@ -75,13 +76,3 @@ func fetchRoleDefinitions(ctx context.Context, subscriptionID string, cli RoleDe } return pbRoleDefs, trace.NewAggregate(fetchErrs...) } - -func ptrsToList(ptrs []*string) []string { //nolint:unused // used in a dependent PR - strList := make([]string, 0, len(ptrs)) - for _, ptr := range ptrs { - if ptr != nil { - strList = append(strList, *ptr) - } - } - return strList -}