-
Notifications
You must be signed in to change notification settings - Fork 2.2k
feat: Add native Go 1.23 Iterator support #3916
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
merchantmoh-debug
wants to merge
14
commits into
google:master
Choose a base branch
from
merchantmoh-debug:bolt-sentinel-client-improvement-10999790790030565127
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
2ad24b1
feat: Add native Go 1.23 Iterator support via code generation
google-labs-jules[bot] 7ef034a
feat: Add native Go 1.23 Iterator support via code generation
google-labs-jules[bot] 86fa05f
Merge branch 'master' into bolt-sentinel-client-improvement-109997907…
merchantmoh-debug e32b6b2
Merge branch 'master' into bolt-sentinel-client-improvement-109997907…
merchantmoh-debug 485cfab
feat: Add native Go 1.23 Iterator support
google-labs-jules[bot] 6c938e8
feat: Add native Go 1.23 Iterator support
google-labs-jules[bot] 141e012
fix: restore missing DependencySBOMCategory
google-labs-jules[bot] fc88d9e
fix: remove redundant TestStringify_Floats to resolve conflict
google-labs-jules[bot] bae64a8
Revert "fix: remove redundant TestStringify_Floats to resolve conflict"
google-labs-jules[bot] a89c0a6
perf: Optimize Stringify with recursion safety and tests
google-labs-jules[bot] 16f2754
Update github/iterators_test.go
merchantmoh-debug 08b31c7
Update github/gen-iterators.go
merchantmoh-debug d2c0ec6
Update github/example_iterators_test.go
merchantmoh-debug b5bac31
Update github/gen-iterators.go
merchantmoh-debug File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -19,3 +19,4 @@ vendor/ | |
| # golangci-lint -v custom generates the following local file: | ||
| custom-gcl | ||
| custom-gcl.exe | ||
| gen-iterators | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,30 @@ | ||
| // Copyright 2025 The go-github AUTHORS. All rights reserved. | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. All new source files created in 2026 should have
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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. | ||
merchantmoh-debug marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| // 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()) | ||
| } | ||
| } | ||
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
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.