title: Can an anonymous go function call itself?
body: <p>I'm just running through the Tour of Go, and got to the tree walker exercise.  Its obvious recursion, but closing the channel is a special case after the final pop off the call stack.  Anyway, I ended up implementing it thusly:</p>
  
  <pre><code>// Walk walks the tree t sending all values
  // from the tree to the channel ch.
  func Walk(t *tree.Tree, ch chan int) {
      var walker func(t *tree.Tree, ch chan int)
      walker = func(t *tree.Tree, ch chan int) {
          if (t.Left != nil) {
              walker(t.Left, ch)
          }
          ch &lt;- t.Value
          if (t.Right != nil) {
              walker(t.Right, ch)
          }
      }
      walker(t, ch)
      close(ch)
  }
  </code></pre>
  
  <p>So far my impression of go is that they prefer to avoid saying things if they can, so the declaration of <code>var walker</code> before the definition seems <em>off</em>.  Perhaps I missed some detail that would allow a function to refer to itself without the declaration?  It would be a little nicer if it could be:</p>
  
  <pre><code>// Walk walks the tree t sending all values
  // from the tree to the channel ch.
  func Walk(t *tree.Tree, ch chan int) {
      func(t *tree.Tree, ch chan int) {
          if (t.Left != nil) {
              __me__(t.Left, ch)
          }
          ch &lt;- t.Value
          if (t.Right != nil) {
              __me__(t.Right, ch)
          }
      }(t, ch)
      close(ch)
  }
  </code></pre>
  
  <p>This is a simple trivia question, but I'm new enough to the language that I am not finding the answer...</p>