39 ms·
Well, sort of, yes. https://play.golang.org/p/qyfqZA5pww https://play.golang.org/p/qyfqZA5pww func main() { go fmt.Println("Hi!") } This is a valid g
by NateDad 10y ago
Well, sort of, yes. https://play.golang.org/p/qyfqZA5pww https://play.golang.org/p/qyfqZA5pww
func main() {
go fmt.Println("Hi!")
}
This is a valid go program (eliding import etc), and it'll almost never print anything.
This is actually a classic mistake when starting with goroutines - not adding synchronization to make sure your main goroutine doesn't exit before any spawned goroutines.