title: How to download file in browser from Go server
body: <p>My code get file from remote url and download file in browser:</p>
  
  <pre><code>func Index(w http.ResponseWriter, r *http.Request) {
      url := "http://upload.wikimedia.org/wikipedia/en/b/bc/Wiki.png"
  
      ...
  
      resp, err := client.Get(url)
      if err != nil {
          fmt.Println(err)
      }
      defer resp.Body.Close()
  
      body, err := ioutil.ReadAll(resp.Body)
      if err != nil {
          fmt.Println(err)
      }
  
      fmt.Println(len(body))
      //download the file in browser
  
  }
  
  func main() {
      http.HandleFunc("/", Index)
      err := http.ListenAndServe(":8000", nil)
  
      if err != nil {
          fmt.Println(err)
      }
  }
  </code></pre>
  
  <p>code: <a href="http://play.golang.org/p/x-EyR2zFjv" rel="noreferrer">http://play.golang.org/p/x-EyR2zFjv</a></p>
  
  <p>Get file is ok, but how to downloaded it in browser?</p>