英文:
How to rebuild godef to work with Go 1.4
问题
升级到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: 在以下位置都找不到包"code.google.com/p/goplan9/plan9/acme":
/Users/bryan/local/go/src/code.google.com/p/goplan9/plan9/acme (来自$GOROOT)
/Users/bryan/sweng/oms/src/code.google.com/p/goplan9/plan9/acme (来自$GOPATH)
英文:
After I upgraded to Go 1.4, godef
is no longer finding many things in the standard libraries, for instance Testing.Fatalf
.
When I try to go get -u
, I get these errors:
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)
答案1
得分: 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
,一切都恢复正常了。
英文:
I had to edit this file because a dependency has moved:
--- 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"
Then go build
and go install
and all working great once more.
答案2
得分: 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
}
英文:
I've experienced the same issue, I edited godef.go though.
--- 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
}
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论