title: goroutine or multithreading is not working in golang
body: <p>I was trying to implement multithreading in golang. I am able to implement go routines but it is not working as expected. below is the sample program which i have prepared,</p>
  
  <pre><code>func test(s string, fo *os.File) {
      var s1 [105]int
      count :=0
      for x :=1000; x&lt;1101;x++ {
      s1[count] = x;
          count++
      }
  
      //fmt.Println(s1[0])
      for i := range s1 {
          runtime.Gosched() 
          sd := s + strconv.Itoa(i)
          var fileMutex sync.Mutex
          fileMutex.Lock()
          fmt.Fprintf(fo,sd)
          defer fileMutex.Unlock()
      }
  }
  
  func main() {
      fo,err :=os.Create("D:/Output.txt")
      if err != nil {
          panic(err)
      }
      for i := 0; i &lt; 4; i++ {
          go test("bye",fo) 
  
      }
  
  
  
  }
  </code></pre>
  
  <p>OUTPUT - good0bye0bye0bye0bye0good1bye1bye1bye1bye1good2bye2bye2bye2bye2.... etc.
  the above program will create a file and write "Hello" and "bye" in the file.</p>
  
  <p>My problem is i am trying to create 5 thread and wanted to process different values values with different thread. if you will see the above example it is printing "bye" 4 times. </p>
  
  <p>i wanted output like below using 5 thread,</p>
  
  <p>good0bye0good1bye1good2bye2....etc....</p>
  
  <p>any idea how can i achieve this?</p>