Skip to content

Commit 1920a2d

Browse files
authored
Correct code snippets in README
When playing around with the samples from the README page, I found some compile errors in the snippets. This PR fixes them
1 parent d402445 commit 1920a2d

1 file changed

Lines changed: 3 additions & 4 deletions

File tree

README.md

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -124,15 +124,14 @@ import (
124124
result, err := client.Users().Get(context.Background(), nil)
125125
if err != nil {
126126
fmt.Printf("Error getting users: %v\n", err)
127-
printOdataError(err error)
127+
printOdataError(err)
128128
return err
129129
}
130130

131131
// Use PageIterator to iterate through all users
132-
pageIterator, err := msgraphcore.NewPageIterator(result, client.GetAdapter(), models.CreateUserCollectionResponseFromDiscriminatorValue)
132+
pageIterator, err := msgraphcore.NewPageIterator[models.Userable](result, client.GetAdapter(), models.CreateUserCollectionResponseFromDiscriminatorValue)
133133

134-
err = pageIterator.Iterate(context.Background(), func(pageItem interface{}) bool {
135-
user := pageItem.(models.Userable)
134+
err = pageIterator.Iterate(context.Background(), func(user models.Userable) bool {
136135
fmt.Printf("%s\n", *user.GetDisplayName())
137136
// Return true to continue the iteration
138137
return true

0 commit comments

Comments
 (0)