What happens if you read a channel to nothing?

Viewed 961

Can you read a goroutine channel into nothing? where does this channel read go to in this statement?

go func() {
  <-ctx.Done()
  logger.Errorf("canceled: %v", ctx.Err())
}()

Addition:

Would this code be any different than if I used the blank identifier

go func() {
  _ = <-ctx.Done()
  logger.Errorf("canceled: %v", ctx.Err())
}()
1 Answers
Related