```
package main
import (
"fmt"
"io/ioutil"
"net/http"
)
func main() {
resp, err := http.Get("https://www.baidu.com")
if err != nil {
fmt.Println("http.Get err=",err)
return
}
bytes, err := ioutil.ReadAll(resp.Body)
if err != nil {
fmt.Println("ioutil.ReadAll err=",err)
return
}
fmt.Println(string(bytes))
}
```
有疑问加站长微信联系(非本文作者))