求大佬解答

107 阅读1分钟

package main

\

import (

    "fmt"

    "io/ioutil"

    "log"

    "net/http"

)

\

func testGet() {

    // www.juhe.cn/box/index/i…

    url := "https//www.baidu.com"

    r, err := http.Get(url)

    if err != nil {

        log.Fatal(err)

    }

    defer r.Body.Close()

    b, _ := ioutil.ReadAll(r.Body)

    fmt.Printf("b: %v\n", string(b))

}

\

func main() {

    testGet()

}

\

报错; [Running] go run "e:\golangproject\ep1\golangWeb2\test_http.go"

package command-line-arguments

    imports net/http

    imports crypto/tls

    imports crypto/x509

    imports net/url

    imports net/http: import cycle not allowed