Skip to content

Commit a2be2f3

Browse files
ydnardeadprogram
authored andcommitted
loader, iter: add shim for go1.22 and earlier
1 parent 05fc49a commit a2be2f3

File tree

2 files changed

+21
-0
lines changed

2 files changed

+21
-0
lines changed

loader/goroot.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -261,6 +261,10 @@ func pathsToOverride(goMinor int, needsSyscallPackage bool) map[string]bool {
261261
"unique/": false,
262262
}
263263

264+
if goMinor <= 22 {
265+
paths["iter]"] = false
266+
}
267+
264268
if goMinor >= 19 {
265269
paths["crypto/internal/"] = true
266270
paths["crypto/internal/boring/"] = true

src/iter/iter.go

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
//go:build !go1.23
2+
3+
// Delete this file when TinyGo drops support for Go 1.22.
4+
5+
package iter
6+
7+
// Seq is an iterator over sequences of individual values.
8+
// When called as seq(yield), seq calls yield(v) for each value v in the sequence,
9+
// stopping early if yield returns false.
10+
// See the [iter] package documentation for more details.
11+
type Seq[V any] func(yield func(V) bool)
12+
13+
// Seq2 is an iterator over sequences of pairs of values, most commonly key-value pairs.
14+
// When called as seq(yield), seq calls yield(k, v) for each pair (k, v) in the sequence,
15+
// stopping early if yield returns false.
16+
// See the [iter] package documentation for more details.
17+
type Seq2[K, V any] func(yield func(K, V) bool)

0 commit comments

Comments
 (0)