Skip to content

Instantly share code, notes, and snippets.

@volker48
Created April 25, 2016 15:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save volker48/f75e9a1374f1cc034ac3ce9fc63e95b6 to your computer and use it in GitHub Desktop.
Save volker48/f75e9a1374f1cc034ac3ce9fc63e95b6 to your computer and use it in GitHub Desktop.
Simple goroutine with bug
package main
import (
"log"
"time"
)
func main() {
// anonymous function
go func() {
time.Sleep(time.Second * 2)
// you won't see this unless your computer is very slow
log.Println("*********************Work complete after 2 seconds**************")
}()
for i := 0; i < 10000; i++ {
//doing stuff
log.Println(i * 4)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment