Foo() in the current goroutine and then starts a separate goroutine to invoke Bar():
go Foo().Bar()
I incorrectly assumed that it created a separate goroutine to evaluate the entire expression. I'm not sure why I assumed that. If you want both
Foo and Bar to be run inside a new goroutine, you need something like this:
go func () { Foo().Bar() }()
Hopefully writing this down will help me remember.
No comments:
Post a Comment