douzhanjia0773 2015-02-24 06:46
浏览 550
已采纳

正确的方法获取golang.org/x/tools/go/ast/astutil

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

  • 写回答

2条回答 默认 最新

  • dongsimang4036 2015-02-24 07:34
    关注

    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)

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥50 关于#html5#的问题:H5页面用户手机返回的时候跳转到指定页面例如(语言-javascript)
  • ¥15 无法使用此凭据登录,因为你的域不可用,如何解决?(标签-Windows)
  • ¥15 yolov9的训练时间
  • ¥15 二叉树遍历没有报错但无法正常运行
  • ¥15 在linux系统下vscode运行robocup3d上场球员报错
  • ¥15 Python语言实验
  • ¥15 SAP HANA SQL 增加合计行
  • ¥20 用C#语言解决一个英文打字练习器,有偿
  • ¥15 srs-sip外部服务 webrtc支持H265格式
  • ¥15 在使用abaqus软件中,继承到assembly里的surfaces怎么使用python批量调动