fork download
  1. package main
  2.  
  3. import "fmt"
  4.  
  5. type T struct {
  6. msg string
  7. }
  8.  
  9. var g *T
  10.  
  11. func setup() {
  12. t := new(T)
  13. t.msg = "hello, world"
  14. g = t
  15. }
  16.  
  17. func main() {
  18. go setup()
  19. for g == nil {
  20. fmt.Print("1")
  21. }
  22. fmt.Print(g.msg)
  23. }
  24.  
Success #stdin #stdout 0s 420672KB
stdin
Standard input is empty
stdout
1hello, world