Skip to content

Commit df7ca31

Browse files
committed
Initialise empty results slice
With this change, if no groups are queried, an empty list is returned instead of null. Signed-off-by: Tom van Dinther <[email protected]>
1 parent b8510c4 commit df7ca31

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

fn.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -501,7 +501,7 @@ func (g *GraphQuery) validateUsers(ctx context.Context, client *msgraphsdk.Graph
501501
return nil, errors.New("no users provided for validation")
502502
}
503503

504-
var results []interface{}
504+
results := make([]interface{}, 0)
505505

506506
for _, userPrincipalName := range in.Users {
507507
if userPrincipalName == nil {
@@ -758,7 +758,7 @@ func (g *GraphQuery) getGroupObjectIDs(ctx context.Context, client *msgraphsdk.G
758758
return nil, errors.New("no group names provided")
759759
}
760760

761-
var results []interface{}
761+
results := make([]interface{}, 0)
762762

763763
for _, groupName := range in.Groups {
764764
if groupName == nil {
@@ -803,7 +803,7 @@ func (g *GraphQuery) getServicePrincipalDetails(ctx context.Context, client *msg
803803
return nil, errors.New("no service principal names provided")
804804
}
805805

806-
var results []interface{}
806+
results := make([]interface{}, 0)
807807

808808
for _, spName := range in.ServicePrincipals {
809809
if spName == nil {

input/v1beta1/input.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ type Input struct {
6969

7070
// FailOnEmpty controls whether the function should fail when input lists are empty.
7171
// If true, the function will error on empty input lists.
72-
// If false or unset, empty lists are valid and will result in a no-op.
72+
// If false or unset, empty lists are valid and will result in an empty list at the target.
7373
// +optional
7474
FailOnEmpty *bool `json:"failOnEmpty,omitempty"`
7575

0 commit comments

Comments
 (0)