Illustration for Medium article “Shutdown All Goroutines”
seen from Germany
seen from Argentina
seen from United States
seen from Yemen
seen from Poland
seen from Spain

seen from United States
seen from United States

seen from Australia
seen from Hong Kong SAR China
seen from Canada
seen from China

seen from Spain
seen from United States

seen from China
seen from United States

seen from United States
seen from China
seen from United States
seen from United States
Illustration for Medium article “Shutdown All Goroutines”
One of the early Feedback received for Social Paster has been that people wanted Login with Facebook functionality. And Heeding the feedback, I have started working on it. Login with Facebook funct...
A good small example of channels usage within Go for async purposes.
Banging my head against channels.
Stop goroutine by closing a quit channel
It's a good practice to stop a goroutine by closing a 'quit' channel.
doSomething := make(chan int) quit := make(chan int) go func() { select { case <- doSomething: fmt.Println("done") case <- quit: fmt.Println("quit") } }() close(quit) // stop the goroutine
It's better than sending a variable to 'quit' channel like,
quit <- 1 // stop the goroutine
because you can stop more than one goroutines by closing it.
Sleep forever
Sleep forever select{}