Skip to content

Commit

Permalink
com#CopyFirst(): Return error if channel is closed from the beginning
Browse files Browse the repository at this point in the history
  • Loading branch information
lippserd committed Apr 30, 2024
1 parent c0b87a9 commit 0f585f7
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions pkg/com/com.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package com

import (
"context"
"github.com/pkg/errors"
"golang.org/x/sync/errgroup"
)

Expand Down Expand Up @@ -64,6 +65,8 @@ func CopyFirst[T any](
}

if !ok {
err = errors.New("can't copy from closed channel")

return
}

Expand Down

0 comments on commit 0f585f7

Please sign in to comment.