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.

Example

                                        

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

Suggest An Answer

No suggestions avaliable!