title: Download *.csv from my server
body: <p>I am new to Golang and now I'm writing small app which parse some page.
  I got index page:</p>
  
  <pre><code>&lt;form action="/" method='POST'&gt;
      Enter credentials:&lt;br&gt;
      Login: &lt;input type="text" name="login" &gt;
      &lt;br&gt;
      Password: &lt;input type="password" name="password" &gt;
      &lt;br&gt;
      Search link:&lt;br&gt;
      &lt;input type="text" name="link" &gt;
      &lt;br&gt;
      &lt;input type="submit" value="Submit"&gt;
   &lt;/form&gt; 
  </code></pre>
  
  <p>So after clicking Submit button it goes to parse page (using tebeca/selenium pkg), and in the end writes data to result.csv like</p>
  
  <pre><code>func writeToCSV(users []linkedinUser) {
  data := users
  enc := struct2csv.New()
  rows, err := enc.Marshal(data)
  if err != nil {
      fmt.Printf("ERROR marshaling file, %s", err)
  }
  file, err := os.Create("result.csv")
  if err != nil {
      fmt.Printf("ERROR creating file, %s", err)
  }
  defer file.Close()
  
  writer := csv.NewWriter(file)
  defer writer.Flush()
  
  for _, value := range rows {
      err := writer.Write(value)
      if err != nil {
          fmt.Printf("ERROR writing file, %s", err)
      }
  }
  </code></pre>
  
  <p>And in the end I got result.csv file in /home/username/go/src/parser/parsertool/src/result.csv</p>
  
  <p>my main.go</p>
  
  <pre><code>func main() {
      r := mux.NewRouter()
  
      r.HandleFunc("/", indexHandler)
      http.Handle("/", r)
  
      err := http.ListenAndServe(":3000", nil) // setting listening port
      if err != nil {
          log.Fatal("ListenAndServe: ", err)
      }
  
  
      func indexHandler(w http.ResponseWriter, r *http.Request) {
      t, _ := template.ParseFiles("./front/index.html")
      badLoginT, _ := template.ParseFiles("./front/error.html")
      r.ParseForm()
      login := r.PostFormValue("login")
      password := r.PostFormValue("password")
      link := r.PostFormValue("link")
      if login != "" || password != "" {
          userCred := logincredentials.SetCredentials(login, password)
          if logincredentials.CheckCredentials(userCred) &amp;&amp; link != "" {
              crawler.Crawl(link, login, password)
          } else {
              badLoginT.Execute(w, nil)
          }
      }
  
      t.Execute(w, nil)
  }
  </code></pre>
  
  <p><strong>So the main question:</strong>
  is there a way to get a link to download result.csv to my hard drive?
  The implementation isn`t important. May be in the end of <em>writeToCSV()</em> when result.csv is ready, window where you could choose where to save file will appear, or after getting result.csv, some link like "Click to download" will appear and after clicking you can see download window etc.</p>
  
  <p>I'm stuck and really don't have any idea how to implement downloading.
  I would be grateful for any help.</p>