Skip to content

Instantly share code, notes, and snippets.

@blakesmith
Created July 11, 2012 00:36
Show Gist options
  • Save blakesmith/3087154 to your computer and use it in GitHub Desktop.
Save blakesmith/3087154 to your computer and use it in GitHub Desktop.
package main
import (
"net/http"
"log"
"io/ioutil"
"fmt"
)
func main() {
url := "http://blakesmith.me"
resp, err := http.Get(url)
if err != nil {
log.Printf("Failed to fetch %s", url)
}
defer resp.Body.Close()
body, err := ioutil.ReadAll(resp.Body)
if err != nil {
log.Printf("Failed to read the response body!")
}
fmt.Println(string(body))
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment