Last active
April 8, 2018 11:20
-
-
Save just1689/b8a3a451367cbba2865c375f4f4d5cbb to your computer and use it in GitHub Desktop.
Process data coming back later
This file contains 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
func main() { | |
in := gen(2, 3) | |
// Distribute the sq work across two goroutines that both read from in. | |
c1 := sq(in) | |
c2 := sq(in) | |
// Consume the merged output from c1 and c2. | |
for n := range merge(c1, c2) { | |
fmt.Println(n) // 4 then 9, or 9 then 4 | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment