lo icon indicating copy to clipboard operation
lo copied to clipboard

Why Async doesn't close a chan?

Open yonesko opened this issue 2 years ago • 0 comments

// Async executes a function in a goroutine and returns the result in a channel.
func Async[A any](f func() A) <-chan A {
	ch := make(chan A, 1)
	go func() {
		ch <- f()
	}()
	return ch
}

Why Async doesn't close the chan?

yonesko avatar Mar 12 '24 12:03 yonesko