dtgv52982 2017-04-28 05:29
浏览 68

去测试导入错误

I've cloned go source code using git clone https://go.googlesource.com/go into my ~/godev/ directory.

My $GOPATH is ~/gocode

I installed go using the installer

If I cd into ~/godev/go/src/net/http and run go test, I get these errors:

h2_bundle.go:46:2: cannot find package "golang_org/x/net/http2/hpack" in any of:
    /usr/local/go/src/golang_org/x/net/http2/hpack (from $GOROOT)
    ~/gocode/src/golang_org/x/net/http2/hpack (from $GOPATH)
h2_bundle.go:47:2: cannot find package "golang_org/x/net/idna" in any of:
    /usr/local/go/src/golang_org/x/net/idna (from $GOROOT)
    ~/gocode/src/golang_org/x/net/idna (from $GOPATH)
h2_bundle.go:48:2: cannot find package "golang_org/x/net/lex/httplex" in any of:
    /usr/local/go/src/golang_org/x/net/lex/httplex (from $GOROOT)
    ~/gocode/src/golang_org/x/net/lex/httplex (from $GOPATH)
transport.go:32:2: cannot find package "golang_org/x/net/proxy" in any of:
    /usr/local/go/src/golang_org/x/net/proxy (from $GOROOT)
    ~/gocode/src/golang_org/x/net/proxy (from $GOPATH)
transfer.go:14:2: use of internal package not allowed

After I follow the directions here by doing cd $GOPATH/src followed by cp -R /usr/local/go/src/vendor/golang_org ., I still get these errors:

h2_bundle.go:47:2: code in directory ~/gocode/src/golang_org/x/net/idna expects import "golang.org/x/net/idna" transport.go:32:2: cannot find package "golang_org/x/net/proxy" in any of: /usr/local/go/src/golang_org/x/net/proxy (from $GOROOT) ~/gocode/src/golang_org/x/net/proxy (from $GOPATH) transfer.go:14:2: use of internal package not allowed

It is true that there is no proxy package under ~/gocode/src/golang_org/x/net, but even if I fixed that somehow, I don't understand the other 2 errors.

  • 写回答

1条回答 默认 最新

  • doushi7314 2017-04-28 05:54
    关注

    Actually, the package golang_org is not a root package and your code requires it for building and can't find it.Simply you have to go get the following package.

    /usr/local/go/src/golang_org/x/net/http2/hpack (from $GOROOT)
    /Users/lf215/go/src/golang_org/x/net/http2/hpack (from $GOPATH)
    

    There is some issue with this version of Go. you may refer https://github.com/constabulary/gb/issues/635

    评论

报告相同问题?

悬赏问题

  • ¥15 想问一下树莓派接上显示屏后出现如图所示画面,是什么问题导致的
  • ¥100 嵌入式系统基于PIC16F882和热敏电阻的数字温度计
  • ¥15 cmd cl 0x000007b
  • ¥20 BAPI_PR_CHANGE how to add account assignment information for service line
  • ¥500 火焰左右视图、视差(基于双目相机)
  • ¥100 set_link_state
  • ¥15 虚幻5 UE美术毛发渲染
  • ¥15 CVRP 图论 物流运输优化
  • ¥15 Tableau online 嵌入ppt失败
  • ¥100 支付宝网页转账系统不识别账号