-
Notifications
You must be signed in to change notification settings - Fork 364
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: correct handling of select comm clause with empty body
Fixes #887.
- Loading branch information
Showing
2 changed files
with
51 additions
and
27 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
package main | ||
|
||
type T struct { | ||
c1 chan string | ||
c2 chan string | ||
} | ||
|
||
func main() { | ||
t := &T{} | ||
t.c2 = make(chan string) | ||
|
||
go func(c chan string) { c <- "done" }(t.c2) | ||
|
||
select { | ||
case msg := <-t.c1: | ||
println("received from c1:", msg) | ||
case <-t.c2: | ||
} | ||
println("Bye") | ||
} | ||
|
||
// Output: | ||
// Bye |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters