@@ -3,7 +3,8 @@ package thand
33import (
44 "errors"
55 "fmt"
6- "sort"
6+ "maps"
7+ "slices"
78 "time"
89
910 cloudevents "github.com/cloudevents/sdk-go/v2"
@@ -435,13 +436,7 @@ func (t *thandTask) makeApprovalNotifications(
435436 // In parallel create a notifier for each of the notifiers
436437 // Build notification tasks for each provider
437438 var notifyTasks []notifyTask
438- providerKeys := make ([]string , 0 , len (approvalsTask .Notifiers ))
439- for providerKey := range approvalsTask .Notifiers {
440- providerKeys = append (providerKeys , providerKey )
441- }
442- sort .Strings (providerKeys )
443-
444- for _ , providerKey := range providerKeys {
439+ for _ , providerKey := range slices .Sorted (maps .Keys (approvalsTask .Notifiers )) {
445440 notifierRequest := approvalsTask .Notifiers [providerKey ]
446441 // Create an ApprovalNotifier for each provider
447442 approvalNotifier := NewApprovalsNotifier (
@@ -554,13 +549,7 @@ func (t *thandTask) notifyApprovalRejection(
554549 }
555550
556551 // Send rejection notification using each configured notifier
557- providerKeys := make ([]string , 0 , len (approvalsTask .Notifiers ))
558- for providerKey := range approvalsTask .Notifiers {
559- providerKeys = append (providerKeys , providerKey )
560- }
561- sort .Strings (providerKeys )
562-
563- for _ , providerKey := range providerKeys {
552+ for _ , providerKey := range slices .Sorted (maps .Keys (approvalsTask .Notifiers )) {
564553 notifierRequest := approvalsTask .Notifiers [providerKey ]
565554 // Create a generic notifier for rejection with the approver as recipient
566555 rejectionRequest := thandFunction.NotifierRequest {
0 commit comments