title: GO routines in a loop - function call
body: <p><strong>Description of the problem</strong></p>
  
  <p>I want to send a concurrent call to each iteration on my <em>for loop</em>.</p>
  
  <p><strong>Current Code</strong></p>
  
  <p>This program mostly try's to find a valid directory on the server </p>
  
  <pre><code>package main
  
  import (
      "bufio"
      "fmt"
      "net/http"
      "os"
  )
  
  func main() {
      var site string
      if len(os.Args) &gt; 1 {
          site = os.Args[1]
      } else {
          fmt.Println("Need the host. Example &gt; http://www.google.com/")
          fmt.Println("wfuzz http://www.google.com/ wordlist.txt")
          site = "http://www.google.com"
          os.Exit(1)
      }
      f, err := os.Open(os.Args[2])
  
      if err != nil {
          fmt.Println("error opening file!", err)
      }
      scanner := bufio.NewScanner(f)
      for scanner.Scan() {
          a := site + scanner.Text()
          get_page(a)
      }
      if err := scanner.Err(); err != nil {
          fmt.Println("error", err)
      }
  
      var input string
      fmt.Scanln(&amp;input)
      fmt.Println("done")
  
  }
  
  func get_page(site string) string {
      a := "\n"
      res, err := http.Get(site)
      if err != nil {
          fmt.Println("error:", err)
      }
      if res.StatusCode != 404 {
          fmt.Println("Page Found!! +::", site, " ::+", res.StatusCode)
      }
      return a
  }
  </code></pre>
  
  <p><strong>Goal to Achieve</strong></p>
  
  <p>What I want to achieve is mostly send on my for loop concurrent calls that way i would speed up the process and would be the end goal for the current program.</p>