升级到Go 1.4后,godef
不再在标准库中找到很多东西,例如Testing.Fatalf
。
当我尝试go get -u
时,我收到了以下错误:
package code.google.com/p/goplan9/plan9/acme
imports code.google.com/p/goplan9/plan9/acme
imports code.google.com/p/goplan9/plan9/acme: cannot find package "code.google.com/p/goplan9/plan9/acme" in any of:
/Users/bryan/local/go/src/code.google.com/p/goplan9/plan9/acme (from $GOROOT)
/Users/bryan/sweng/oms/src/code.google.com/p/goplan9/plan9/acme (from $GOPATH)
答案 0 :(得分:3)
我必须编辑此文件,因为依赖项已移动:
--- a/exp/cmd/godef/acme.go
+++ b/exp/cmd/godef/acme.go
@@ -1,7 +1,7 @@
package main
import (
- "code.google.com/p/goplan9/plan9/acme"
+ "9fans.net/go/acme"
"fmt"
"io"
"os"
然后go build
和go install
再一次工作得很好。
答案 1 :(得分:0)
我遇到了同样的问题,但我编辑了godef.go。
--- a/exp/cmd/godef/godef.go 2015-01-19 15:29:10.760304470 -0500
+++ b/exp/cmd/godef/godef.go 2015-02-10 21:36:29.678102962 -0500
@@ -47,7 +47,7 @@
}
r := runtime.GOROOT()
if r != "" {
- gopath = append(gopath, r+"/src/pkg")
+ gopath = append(gopath, r+"/src")
}
types.GoPath = gopath
}