src/cmd/link/testdata/linkname/ok.go
raw| 1 | // Copyright 2024 The Go Authors. All rights reserved. |
| 2 | // Use of this source code is governed by a BSD-style |
| 3 | // license that can be found in the LICENSE file. |
| 4 | |
| 5 | // Use of public API is ok. |
| 6 | |
| 7 | package main |
| 8 | |
| 9 | import ( |
| 10 | "iter" |
| 11 | "unique" |
| 12 | ) |
| 13 | |
| 14 | func seq(yield func(int) bool) { |
| 15 | yield(123) |
| 16 | } |
| 17 | |
| 18 | var s = "hello" |
| 19 | |
| 20 | func main() { |
| 21 | h := unique.Make(s) |
| 22 | next, stop := iter.Pull(seq) |
| 23 | defer stop() |
| 24 | println(h.Value()) |
| 25 | println(next()) |
| 26 | println(next()) |
| 27 | } |