// http.gopackage mainimport ( "fmt" "io" "net/http" "os")func main() { resp, err := http.Get("http://www.oschina.net") if err != nil { fmt.Println("Get http://www.oschina.net error: ", err.Error()) return } defer resp.Body.Close() io.Copy(os.Stdout, resp.Body)}
输出结果:
略