英文:
Correct way to get golang.org/x/tools/go/ast/astutil
问题
似乎存储库已从golang.org/x/tools/astutil
移动到golang.org/x/tools/go/ast/astutil
。
我正在尝试构建gore
,但找不到astutil
,我有一个解决方法可以让它编译:
mkdir $GOPATH/src/golang.org/x/tools/go/ast
ln -s $GOPATH/src/golang.org/x/tools/astutil $GOPATH/src/golang.org/x/tools/go/ast
但这是修复的正确方法吗?
我尝试删除x/tools
目录并重新获取它,使用以下命令:
rm -rf $GOPATH/src/golang.org/x/tools
go get -u -v golang.org/x/tools
但astutil
仍然在相同的目录(x/tools/go/astutil
)而不是x/tools/go/ast/astutil
。
我尝试过go get -u -v golang.org/x/tools/go/ast/astutil
,但似乎不起作用:
Fetching https://golang.org/x/tools/go/ast/astutil?go-get=1
Parsing meta tags from https://golang.org/x/tools/go/ast/astutil?go-get=1
(status code 200)
get "golang.org/x/tools/go/ast/astutil?": found meta tag
main.metaImport{Prefix:"golang.org/x/tools", VCS:"git", RepoRoot:"
https://go.googlesource.com/tools"} at
https://golang.org/x/tools/go/ast/astutil?go-get=1
get "golang.org/x/tools/go/ast/astutil?": verifying non-authoritative meta
tag
Fetching https://golang.org/x/tools?go-get=1
Parsing meta tags from https://golang.org/x/tools?go-get=1 (status code 200)
golang.org/x/tools (download)
package golang.org/x/tools/go/ast/astutil?: /home/asd/Dropbox/go/src/
golang.org/x/tools exists but /home/asd/Dropbox/go/src/
golang.org/x/tools/.git does not - stale checkout?
修复这个问题的正确方法是什么?
我的go版本:go version go1.4.1 linux/amd64
英文:
It seems the repository has moved from golang.org/x/tools/astutil
to golang.org/x/tools/go/ast/astutil
I'm trying to build gore
but it cannot found the astutil
, I have the workaround to get it compiled:
mkdir $GOPATH/src/golang.org/x/tools/go/ast
ln -s $GOPATH/src/golang.org/x/tools/astutil $GOPATH/src/golang.org/x/tools/go/ast
but is this the correct way to fix this?
I've tried to remove the x/tools
directory and fetch it again, using this command:
rm -rf $GOPATH/src/golang.org/x/tools
go get -u -v golang.org/x/tools
but astutil
still on the same directory (x/tools/go/astutil
) instead of x/tools/go/ast/astutil
I've tried to go get -u -v golang.org/x/tools/go/ast/astutil
but it seems not working:
Fetching https://golang.org/x/tools/go/ast/astutil?go-get=1
Parsing meta tags from https://golang.org/x/tools/go/ast/astutil?go-get=1
(status code 200)
get "golang.org/x/tools/go/ast/astutil?": found meta tag
main.metaImport{Prefix:"golang.org/x/tools", VCS:"git", RepoRoot:"
https://go.googlesource.com/tools"} at
https://golang.org/x/tools/go/ast/astutil?go-get=1
get "golang.org/x/tools/go/ast/astutil?": verifying non-authoritative meta
tag
Fetching https://golang.org/x/tools?go-get=1
Parsing meta tags from https://golang.org/x/tools?go-get=1 (status code 200)
golang.org/x/tools (download)
package golang.org/x/tools/go/ast/astutil?: /home/asd/Dropbox/go/src/
golang.org/x/tools exists but /home/asd/Dropbox/go/src/
golang.org/x/tools/.git does not - stale checkout?
What's the correct way to fix this?
My go version: go version go1.4.1 linux/amd64
答案1
得分: 2
我刚刚尝试了以下命令:
C:\Users\VonC\prog\go\src\github.com\golang\lint>go get -t -v ./...
golang.org/x/tools/go/exact
golang.org/x/tools/go/ast/astutil
golang.org/x/tools/go/types
golang.org/x/tools/go/gcimporter
github.com/golang/lint
github.com/golang/lint/golint
这足以至少编译所有依赖的工具,包括 golang.org/x/tools/go/ast/astutil
,但没有获取它们的源代码。
对于只有 astutil
的情况,我还尝试了以下命令:
C:\Users\VonC\prog\go>go get golang.org/x/tools/go/ast/astutil
C:\Users\VonC\prog\go>cd src
C:\Users\VonC\prog\go\src>cd golang.org/x/tools/go/ast/astutil
C:\Users\VonC\prog\go\src\golang.org\x\tools\go\ast\astutil>dir
目录: C:\Users\VonC\prog\go\src\golang.org\x\tools\go\ast\astutil
03/02/2015 07:41 <DIR> .
03/02/2015 07:41 <DIR> ..
03/02/2015 07:41 16,003 enclosing.go
03/02/2015 07:41 4,655 enclosing_test.go
03/02/2015 07:41 9,191 imports.go
03/02/2015 07:41 11,035 imports_test.go
03/02/2015 07:41 211 util.go
如果 go get golang.org/x/tools/go/ast/astutil
不起作用,请尝试在一个独立且干净的 Go 工作区中使用全新安装的 Go 1.4.2(这意味着使用不同的 GOROOT
引用新安装,以及使用不同的 GOPATH
引用一个空的和全新的工作区)。
英文:
I just tried:
C:\Users\VonC\prog\go\src\github.com\golang\lint>go get -t -v ./...
golang.org/x/tools/go/exact
golang.org/x/tools/go/ast/astutil
golang.org/x/tools/go/types
golang.org/x/tools/go/gcimporter
github.com/golang/lint
github.com/golang/lint/golint
That was enough to at least compile all dependent tools including golang.org/x/tools/go/ast/astutil
, but not get their sources.
For just astutil
, I also tried:
C:\Users\VonC\prog\go>go get golang.org/x/tools/go/ast/astutil
C:\Users\VonC\prog\go>cd src
C:\Users\VonC\prog\go\src>cd golang.org/x/tools/go/ast/astutil
C:\Users\VonC\prog\go\src\golang.org\x\tools\go\ast\astutil>dir
Répertoire de C:\Users\VonC\prog\go\src\golang.org\x\tools\go\ast\astutil
03/02/2015 07:41 <REP> .
03/02/2015 07:41 <REP> ..
03/02/2015 07:41 16 003 enclosing.go
03/02/2015 07:41 4 655 enclosing_test.go
03/02/2015 07:41 9 191 imports.go
03/02/2015 07:41 11 035 imports_test.go
03/02/2015 07:41 211 util.go
If go get golang.org/x/tools/go/ast/astutil
doesn't work, try with a fresh installation of Go 1.4.2, in a separate and clean Go workspace (meaning a different GOROOT
for referencing a new installation, and a different GOPATH
, for referencing an empty and fresh workspace)
答案2
得分: 0
解决方案:
cd $GOPATH/src/code.google.com/p/
rm -rf go.*
cd $GOPATH/src/golang.org/x/
rm -rf *
go get -u -v golang.org/x/tools
go get -u -v golang.org/x/crypto
go get -u -v golang.org/x/image
go get -u -v golang.org/x/mobile
go get -u -v golang.org/x/net
go get -u -v golang.org/x/sys
go get -u -v golang.org/x/text
可能是我的错误是我从code.google.com/p
而不是golang.org/x
进行了go get
操作?
英文:
Solution for my problem:
cd $GOPATH/src/code.google.com/p/
rm -rf go.*
cd $GOPATH/src/golang.org/x/
rm -rf *
go get -u -v golang.org/x/tools
go get -u -v golang.org/x/crypto
go get -u -v golang.org/x/image
go get -u -v golang.org/x/mobile
go get -u -v golang.org/x/net
go get -u -v golang.org/x/sys
go get -u -v golang.org/x/text
Probably my fault is I go get
from code.google.com/p
instead of golang.org/x
?
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论