Skip to content

iter: example Pairs in package doc uses wrong (outdated?) signature for iter.Seq2 #68056

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

Closed
powerman opened this issue Jun 18, 2024 · 2 comments
Labels
Documentation Issues describing a change to documentation. NeedsFix The path to resolution is known, but the work has not been done.
Milestone

Comments

@powerman
Copy link

Go version

unreleased (current master)

Output of go env in your module/workspace:

N/A

What did you do?

Read https://cs.opensource.google/go/go/+/master:src/iter/iter.go;l=122

What did you see happen?

	func Pairs[V any](seq iter.Seq[V]) iter.Seq2[V, V] {
		return func(yield func(V, V) bool) bool {
			// a couple return true/false inside

What did you expect to see?

	func Pairs[V any](seq iter.Seq[V]) iter.Seq2[V, V] {
		return func(yield func(V, V) bool) {
			// no return inside
@seankhliao seankhliao added Documentation Issues describing a change to documentation. NeedsFix The path to resolution is known, but the work has not been done. labels Jun 18, 2024
@seankhliao seankhliao added this to the Go1.23 milestone Jun 18, 2024
@jimmyfrasche
Copy link
Member

Also https://cs.opensource.google/go/go/+/master:src/iter/iter.go;l=34 has _, v := range seq but seq is a Seq[V]

@gopherbot
Copy link
Contributor

Change https://go.dev/cl/593555 mentions this issue: iter: minor doc comment updates

Mchnan pushed a commit to Mchnan/go-sylixos that referenced this issue Jul 9, 2024
Remove old return value. Use single variable range for iter.Seq[V].
Rewrite Pairs implementation to not loop forever.

Fixes golang#68056
Fixes golang#68073

Change-Id: I7ede0fe8ed058bbd57869d87e17b7f2c3641f7dd
Reviewed-on: https://go-review.googlesource.com/c/go/+/593555
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Reviewed-by: Damien Neil <dneil@google.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
Commit-Queue: Ian Lance Taylor <iant@google.com>
Reviewed-by: Mauri de Souza Meneguzzo <mauri870@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Documentation Issues describing a change to documentation. NeedsFix The path to resolution is known, but the work has not been done.
Projects
None yet
Development

No branches or pull requests

4 participants