错误:
# net
loading DWARF type: decoding dwarf section info at offset 0xac: unexpected opcode
编译:
CGO_ENABLED=1 GOOS=linux GOARCH=mipsle CC=mipsel-linux-gcc go build
代码:
package main
import (
"fmt"
"io/ioutil"
"net/http"
)
func main() {
resp, err := http.Get("http://www.baidu.com")
if err != nil {
fmt.Println(err)
return
}
defer resp.Body.Close()
headers := resp.Header
for k, v := range headers {
fmt.Println(k, ": ", v)
}
data, _ := ioutil.ReadAll(resp.Body)
fmt.Println(string(data))
}
有疑问加站长微信联系(非本文作者)