Skip to content

Commit

Permalink
plugin: Always forward the close channel receive
Browse files Browse the repository at this point in the history
Reference: https://go.dev/ref/spec#Receive_operator

The second return value will always be false, as the channel's purpose is to be closed and trigger cleanup.
  • Loading branch information
bflad committed Feb 4, 2022
1 parent 9f45445 commit 3b5650f
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions plugin/serve.go
Original file line number Diff line number Diff line change
Expand Up @@ -150,11 +150,10 @@ func tf5serverServe(opts *ServeOpts) error {
reattachConfigCh := make(chan *plugin.ReattachConfig)

go func() {
val, ok := <-closeCh

if ok {
opts.TestConfig.CloseCh <- val
}
// Always forward close channel receive, since its signaling that
// the channel is closed.
val := <-closeCh
opts.TestConfig.CloseCh <- val
}()

go func() {
Expand Down

0 comments on commit 3b5650f

Please sign in to comment.