package main

import (
	"fmt"
	"sync"
)

func One() {
	Two()
	fmt.Println("One!")
}

func Two() {
	Three()
	fmt.Println("Two!")
}

func Three() {
	fmt.Println("Three!")
}

// Used in the simple example
// func main() {
// 	msg := "Hello debugger"
// 	One()
// 	fmt.Println(msg)

// }

// Used for Goroutine debugging

func printMe(i int, wg *sync.WaitGroup) {
	defer wg.Done()
	fmt.Printf("I'm a go routine %d\n", i)
}

func main() {
	i := 0

	var wg sync.WaitGroup
	wg.Add(9)

	for i < 10 {
		go func(rI int) {
			printMe(rI, &wg)
		}(i)
		i++
	}

	wg.Wait()
}
