title: How can I exit from a goroutine (from within) from anywhere on the stack?
body: <p>For example:</p>
  
  <pre><code>func foo() {
      // How can I exit the goroutine here?
  }
  
  func bar() {
      foo()
  }
  
  func goroutine() {
      for {
          bar()
      }
  }
  
  func main() {
      go goroutine()
  }
  </code></pre>
  
  <p>How can I exit the goroutine directly from <code>foo()</code> or <code>bar()</code>? I was thinking of maybe using <code>panic</code> and <code>recover</code>, but I am not sure exactly how they work. (With traditional exception handling, I would just wrap the body of <code>goroutine()</code> in a <code>try</code> block and throw an exception when I want to exit.)</p>
  
  <p>EDIT: If I used <code>panic</code>, do I even need to <code>recover()</code>?</p>