如何重建godef以使用Go 1.4

时间:2015-01-09 12:04:48

标签: go

升级到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)

2 个答案:

答案 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 buildgo 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
}