Created
July 4, 2019 19:02
-
-
Save ddadlani/247b0dcea60e835d937a10ce0aa786f7 to your computer and use it in GitHub Desktop.
Channel testing example
This file contains hidden or 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
func CallerMethod() { | |
events := make(chan string) | |
go func() { | |
Callee(events) | |
}() | |
select { | |
case msg := <-events: | |
fmt.Println(msg) | |
} | |
} | |
func Callee(events chan string) { | |
events <- "hello" | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment