FindFirstAndFlush flushes source concurrently
This commit is contained in:
parent
a85ba0011d
commit
79805d1fdc
2
find.go
2
find.go
@ -9,7 +9,7 @@ func FindFirst[T any](source <-chan T) *T {
|
|||||||
|
|
||||||
func FindFirstAndFlush[T any](source <-chan T) *T {
|
func FindFirstAndFlush[T any](source <-chan T) *T {
|
||||||
for v := range source {
|
for v := range source {
|
||||||
Flush(source)
|
go Flush(source)
|
||||||
return &v
|
return &v
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
|
Loading…
Reference in New Issue
Block a user