package main import ( "fmt" "os" "time" ) func bgChecker() { for { if check == true { fmt.Println("Check has been set to true, quitting") os.Exit(0) } time.Sleep(time.Second) } } func fun1() { go bgChecker() for { fmt.Printf("Would you like to set the check to true? [y/n] ") fmt.Scanln(&choice) if choice == "y" { check = true } else { fmt.Println("Too bad") } } }