Skip to content

Instantly share code, notes, and snippets.

@7yan00
Last active August 29, 2015 14:11
Show Gist options
  • Save 7yan00/bba6b37deb09f53a4728 to your computer and use it in GitHub Desktop.
Save 7yan00/bba6b37deb09f53a4728 to your computer and use it in GitHub Desktop.
dwgo#5
package main
import (
"io"
"net/http"
"os"
)
func main() {
var url string = "http://yukkurisinai.net/gopher.png"
response, err := http.Get(url)
if err != nil {
panic(err)
}
defer response.Body.Close()
file, err := os.Create("Gopher.jpg" )
if err != nil {
panic(err)
}
defer file.Close()
io.Copy(file, response.Body)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment