Skip to content

Instantly share code, notes, and snippets.

@7yan00
Created October 22, 2014 04:24
Show Gist options
  • Save 7yan00/16f324367ceb23185349 to your computer and use it in GitHub Desktop.
Save 7yan00/16f324367ceb23185349 to your computer and use it in GitHub Desktop.
package main
import (
"fmt"
"io/ioutil"
"net/http"
"os"
)
func main() {
response, err := http.Get("http://golang.jp/index.html")
if err != nil {
fmt.Println(err)
os.Exit(1)
}
fmt.Println("status:", response.Status)
body, err := ioutil.ReadAll(response.Body)
if err != nil {
fmt.Println(err)
os.Exit(1)
}
fmt.Println(string(body))
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment