我已经将 go 源代码克隆到我git clone https://go.googlesource.com/go
的~/godev/
目录中。
我的 $GOPATH 是~/gocode
我使用安装程序安装了 go
如果我 cd into~/godev/go/src/net/http
并运行go test
,我会收到以下错误:
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
在我按照此处的说明进行操作cd $GOPATH/src
之后cp -R /usr/local/go/src/vendor/golang_org .
,我仍然会收到以下错误:
h2_bundle.go:47:2: 目录 ~/gocode/src/golang_org/x/net/idna 中的代码需要导入“golang.org/x/net/idna” transport.go:32:2: 找不到包“golang_org /x/net/proxy” 在以下任何一个中:/usr/local/go/src/golang_org/x/net/proxy(来自 $GOROOT)~/gocode/src/golang_org/x/net/proxy(来自 $GOPATH) transfer.go:14:2:不允许使用内部包
确实 ~/gocode/src/golang_org/x/net 下没有代理包,但是即使我以某种方式修复了它,我也不理解其他 2 个错误。