Skip to content

Instantly share code, notes, and snippets.

@just1689
Last active April 8, 2018 11:20
Show Gist options
  • Save just1689/5a91d7b00f76e7ebb65b95d7fe0fa66e to your computer and use it in GitHub Desktop.
Save just1689/5a91d7b00f76e7ebb65b95d7fe0fa66e to your computer and use it in GitHub Desktop.
Convert values to futures
func gen(nums ...int) <-chan int {
out := make(chan int)
go func() {
for _, n := range nums {
out <- n
}
close(out)
}()
return out
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment