concurrency - Go: invoking methods concurrently isn't working for me -
this question has answer here:
- what's wrong golang code? 2 answers
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
Post a Comment