It is a function that runs concurrently with other functions. If you want to stop it, you will have to pass a signal channel to the goroutine, which will push a value into when you want the function to finish.

BY Best Interview Question ON 11 Mar 2020

Example

Quit : = make (chan bool) 
       go func ( ) { 
            for  { 
                 select { 
                       case <- quit: 
                       return 
                      default 
                        // do other stuff 
                } 
           } 
    }() 
   // Do stuff 
   // Quit goroutine 
Quit <- true