That's because when you call a function with go
(ie as a goroutine) it is run in the background and execution continues. In this case, you have nothing for the program to do after invoking the goroutine so it just completes and you see no output. Why do you need two? Well you don't, it's just the 1 second sleep wasn't long enough, if you had time.Sleep(2000)
you'd probably get the same result (though it's not guaranteed). Generally when using a goroutine, you need some kind of blocking statement some where. The simplest way to do this, imo, is to pass a channel to the goroutine and then receive from it.
This isn't the most useful example due to the structuring of your code, but here's a modified version of your program that will block until the first goroutine completes. Since you're actually invoking 10 goroutines, you would need a bit more robust logic to block until of them complete but a more reasonable solution would be to put the loop in the gouroutine, rather than invoking 10 goroutines. https://play.golang.org/p/66g9u8Bhjj
Also, check out this more realistic example in the go tour; https://tour.golang.org/concurrency/2