Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,4 @@ vendor/
# golangci-lint -v custom generates the following local file:
custom-gcl
custom-gcl.exe
gen-iterators
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

With the addition of //go:generate, this executable should never have to be built, and therefore this line is unnecessary. Please remove.

30 changes: 30 additions & 0 deletions github/example_iterators_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
// Copyright 2025 The go-github AUTHORS. All rights reserved.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All new source files created in 2026 should have // Copyright 2026 ....

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes >.<; good catch.

//
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.

package github_test

import (
"context"
"fmt"
"log"

"github.com/google/go-github/v81/github"
)

func ExampleRepositoriesService_ListByUserIter() {
client := github.NewClient(nil)
ctx := context.Background()

// List all repositories for a user using the iterator.
// This automatically handles pagination.
// Note that if `opts` is `nil`, a new empty `opts` will be created and used within the iterator.
opts := &github.RepositoryListByUserOptions{Type: "public"}
for repo, err := range client.Repositories.ListByUserIter(ctx, "octocat", opts) {
if err != nil {
log.Fatalf("Error listing repos: %v", err)
}
fmt.Println(repo.GetName())
}
}
Loading
Loading