Skip to content

Commit 966e551

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 966e551

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
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 {

0 commit comments

Comments
 (0)