concurrency - Go: invoking methods concurrently isn't working for me -


this question has answer here:

i'm new go. i'm trying out example want perform concurrent call method. isn't working me (i don't see output).

based on "effective go", says concurrency supported methods , functions. doing wrong?

thanks, -srikanth

package main  import (     "fmt" )  type hello struct {     int }  func (h *hello) myprint (value string) {     go func() {         fmt.println(value)     } () }  func main() {     h := &hello{100}      go h.myprint("need go") } 

your main exits , process dies before goroutine has chance print output.


Comments

Popular posts from this blog

node.js - How to mock a third-party api calls in the backend -

node.js - Why do I get "SOCKS connection failed. Connection not allowed by ruleset" for some .onion sites? -

matlab - 0-by-1 sym - What do I need to change in order to get proper symbolic results? -