title: Calling non-goroutine function with goroutines
body: <p>I have part of a script with the following format:</p>
  
  <pre><code>func main() {
    for i=0;i&lt;1000000;i++ {
      go test()
    }
  }
  func test() {
      a := test2()
  }
  func test2()(var int) {
      //a bunch of operations
      return var
  }
  </code></pre>
  
  <p>I run a lot of iterations and it always work. I'm wondering is there any chance that two or more goroutines calling function "test2()" at the same time and cause a crash? Is the following format anyway better then the previous one?</p>
  
  <pre><code>func main() {
      for i=0;i&lt;1000000;i++ {
          go test()
      }
  }
  func test() {
      test2 := func()(var int){
          //a bunch of operations
          return var
      }
      a := test2()
  }
  </code></pre>
  
  <p>Thank you very much!</p>