package main import "fmt" import "net/http" import "io/ioutil" func main() { resp, err := http.Get("http://google.com") if err != nil { fmt.Printf("%s\n", err) return } if resp.StatusCode != 200 { fmt.Printf("Status: %d\n",resp.StatusCode) return } defer resp.Body.Close() body, err := ioutil.ReadAll(resp.Body) if err != nil { fmt.Printf("I/O Error: %s\n", err) return } fmt.Printf("%s\n", body) }