Skip to content

Instantly share code, notes, and snippets.

@erukiti
Created December 10, 2014 10:45
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save erukiti/359db6afd854e1d2ccaf to your computer and use it in GitHub Desktop.
Save erukiti/359db6afd854e1d2ccaf to your computer and use it in GitHub Desktop.
package main
import (
"fmt"
"io/ioutil"
"net/http"
)
func main() {
url := "http://yukkurisinai.net/gopher.png"
resp, err := http.Get(url)
if err != nil {
fmt.Println(err)
return
}
body, err := ioutil.ReadAll(resp.Body)
if err != nil {
fmt.Println(err)
return
}
ioutil.WriteFile("gopher.png", body, 0644)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment