英文:
VS Code can't install the Go tools
问题
我尝试在VSCode中开始使用Go。我已经安装了Go和Git,并在Code中创建了一个包含一个.go
文件的项目。
当我输入内容时,VSCode会警告我缺少golint
等工具,并提示我安装它们。我点击"Install all"。
然后控制台显示如下信息:
安装了10个工具
gocode
gopkgs
go-outline
go-symbols
guru
gorename
godef
goreturns
golint
gotests
安装gocode成功
安装gopkgs成功
安装go-outline成功
安装go-symbols失败
安装guru失败
安装gorename失败
安装godef成功
安装goreturns失败
安装golint失败
安装gotests失败
有6个工具安装失败。
go-symbols:
错误:命令失败:C:\ Go \ bin \ go.exe get -u -v github.com / newhook / go-symbols
github.com / newhook / go-symbols(下载)
从https://golang.org/x/tools/go/buildutil?go-get=1获取
从https://golang.org/x/tools/go/buildutil?go-get=1解析元标记(状态码200)
获取“golang.org/x/tools/go/buildutil”:在https://golang.org/x/tools/go/buildutil?go-get=1找到元标记main.metaImport {Prefix:“golang.org/x/tools”,VCS:“git”,RepoRoot:“https://go.googlesource.com/tools”;}
获取“golang.org/x/tools/go/buildutil”:验证非权威元标记
从https://golang.org/x/tools?go-get=1获取
从https://golang.org/x/tools?go-get=1解析元标记(状态码200)
golang.org/x/tools(下载)
#cd C:\ Users \ user \ go \ src \ golang.org \ x \ tools; git pull --ff-only
致命:不是git存储库(或任何父目录之一):.git
包golang.org/x/tools/go/buildutil:退出状态128
github.com / newhook / go-symbols(下载)
从https://golang.org/x/tools/go/buildutil?go-get=1获取
从https://golang.org/x/tools/go/buildutil?go-get=1解析元标记(状态码200)
获取“golang.org/x/tools/go/buildutil”:在https://golang.org/x/tools/go/buildutil?go-get=1找到元标记main.metaImport {Prefix:“golang.org/x/tools”,VCS:“git”,RepoRoot:“https://go.googlesource.com/tools”;}
获取“golang.org/x/tools/go/buildutil”:验证非权威元标记
从https://golang.org/x/tools?go-get=1获取
从https://golang.org/x/tools?go-get=1解析元标记(状态码200)
golang.org/x/tools(下载)
#cd C:\ Users \ user \ go \ src \ golang.org \ x \ tools; git pull --ff-only
致命:不是git存储库(或任何父目录之一):.git
包golang.org/x/tools/go/buildutil:退出状态128
guru:
错误:命令失败:C:\ Go \ bin \ go.exe get -u -v golang.org / x / tools / cmd / guru
从https://golang.org/x/tools/cmd/guru?go-get=1获取
从https://golang.org/x/tools/cmd/guru?go-get=1解析元标记(状态码200)
获取“golang.org/x/tools/cmd/guru”:在https://golang.org/x/tools/cmd/guru?go-get=1找到元标记main.metaImport {Prefix:“golang.org/x/tools”,VCS:“git”,RepoRoot:“https://go.googlesource.com/tools”;}
获取“golang.org/x/tools/cmd/guru”:验证非权威元标记
从https://golang.org/x/tools?go-get=1获取
从https://golang.org/x/tools?go-get=1解析元标记(状态码200)
golang.org/x/tools(下载)
#cd C:\ Users \ user \ go \ src \ golang.org \ x \ tools; git pull --ff-only
致命:不是git存储库(或任何父目录之一):.git
包golang.org/x/tools/cmd/guru:退出状态128
从https://golang.org/x/tools/cmd/guru?go-get=1获取
从https://golang.org/x/tools/cmd/guru?go-get=1解析元标记(状态码200)
获取“golang.org/x/tools/cmd/guru”:在https://golang.org/x/tools/cmd/guru?go-get=1找到元标记main.metaImport {Prefix:“golang.org/x/tools”,VCS:“git”,RepoRoot:“https://go.googlesource.com/tools”;}
获取“golang.org/x/tools/cmd/guru”:验证非权威元标记
从https://golang.org/x/tools?go-get=1获取
从https://golang.org/x/tools?go-get=1解析元标记(状态码200)
golang.org/x/tools(下载)
#cd C:\ Users \ user \ go \ src \ golang.org \ x \ tools; git pull --ff-only
致命:不是git存储库(或任何父目录之一):.git
包golang.org/x/tools/cmd/guru:退出状态128
gorename:
错误:命令失败:C:\ Go \ bin \ go.exe get -u -v golang.org / x / tools / cmd / gorename
从https://golang.org/x/tools/cmd/gorename?go-get=1获取
从https://golang.org/x/tools/cmd/gorename?go-get=1解析元标记(状态码200)
获取“golang.org/x/tools/cmd/gorename”:在https://golang.org/x/tools/cmd/gorename?go-get=1找到元标记main.metaImport {Prefix:“golang.org/x/tools”,VCS:“git”,RepoRoot:“https://go.googlesource.com/tools”;}
获取“golang.org/x/tools/cmd/gorename”:验证非权威元标记
从https://golang.org/x/tools?go-get=1获取
从https://golang.org/x/tools?go-get=1解析元标记(状态码200)
golang.org/x/tools(下载)
#cd C:\ Users \ user \ go \ src \ golang.org \ x \ tools; git pull --ff-only
致命:不是git存储库(或任何父目录之一):.git
包golang.org/x/tools/cmd/gorename:退出状态128
从https://golang.org/x/tools/cmd/gorename?go-get=1获取
从https://golang.org/x/tools/cmd/gorename?go-get=1解析元标记(状态码200)
获取“golang.org/x/tools/cmd/gorename”:在https://golang.org/x/tools/cmd/gorename?go-get=1找到元标记main.metaImport {Prefix:“golang.org/x/tools”,VCS:“git”,RepoRoot:“https://go.googlesource.com/tools”;}
获取“golang.org/x/tools/cmd/gorename”:验证非权威元标记
从https://golang.org/x/tools?go-get=1获取
从https://golang.org/x/tools?go-get=1解析元标记(状态码200)
golang.org/x/tools(下载)
#cd C:\ Users \ user \ go \ src \ golang.org \ x \ tools; git pull --ff-only
致命:不是git存储库(或任何父目录之一):.git
包golang.org/x/tools/cmd/gorename:退出状态128
goreturns:
错误:命令失败:C:\ Go \ bin \ go.exe get -u -v sourcegraph.com / sqs / goreturns
从https://sourcegraph.com/sqs/goreturns?go-get=1获取
从https://sourcegraph.com/sqs/goreturns?go-get=1解析元标记(状态码200)
获取“sourcegraph.com/sqs/goreturns”:在https://sourcegraph.com/sqs/goreturns?go-get=1找到元标记main.metaImport {Prefix:“sourcegraph.com/sqs/goreturns”,VCS:“git”,RepoRoot:“https://github.com/sqs/goreturns”;}
sourcegraph.com/sqs/goreturns(下载)
github.com/sqs/goreturns(下载)
从https://golang.org/x/tools/imports?go-get=1获取
从https://golang.org/x/tools/imports?go-get=1解析元标记(状态码200)
获取“golang.org/x/tools/imports”:在https://golang.org/x/tools/imports?go-get=1找到元标记main.metaImport {Prefix:“golang.org/x/tools”,VCS:“git”,RepoRoot:“https://go.googlesource.com/tools”;}
获取“golang.org/x/tools/imports”:验证非权威元标记
从https://golang.org/x/tools?go-get=1获取
从https://golang.org/x/tools?go-get=1解析元标记(状态码200)
golang.org/x/tools(下载)
#cd C:\ Users \ user \ go \ src \ golang.org \ x \ tools; git pull --ff-only
致命:不是git存储库(或任何父目录之一):.git
包golang.org/x/tools/imports:退出状态128
从https://sourcegraph.com/sqs/goreturns?go-get=1获取
从https://sourcegraph.com/sqs/goreturns?go-get=1解析元标记(状态码200)
获取“sourcegraph.com/sqs/goreturns”:在https://sourcegraph.com/sqs/goreturns?go-get=1找到元标记main.metaImport {Prefix:“sourcegraph.com/sqs/goreturns”,VCS:“git”,RepoRoot:“https://github.com/sqs/goreturns”;}
sourcegraph.com/sqs/goreturns(下载)
github.com/sqs/goreturns(下载)
从https://golang.org/x/tools/imports?go-get=1获取
从https://golang.org/x/tools/imports?go-get=1解析元标记(状态码200)
获取“golang.org/x/tools/imports”:在https://golang.org/x/tools/imports?go-get=1找到元标记main.metaImport {Prefix:“golang.org/x/tools”,VCS:“git”,RepoRoot:“https://go.googlesource.com/tools”;}
获取“golang.org/x/tools/imports”:验证非权威元标记
从https://golang.org/x/tools?go-get=1获取
从https://golang.org/x/tools?go-get=1解析元标记(状态码200)
golang.org/x/tools(下载)
#cd C:\ Users \ user \ go \ src \ golang.org \ x \ tools; git pull --ff-only
致命:不是git存储库(或任何父目录之一):.git
包golang.org/x/tools/imports:退出状态128
golint:
错误:命令失败:C:\ Go \ bin \ go.exe get -u -v github.com / golang / lint / golint
github.com / golang / lint(下载)
从https://golang.org/x/tools/go/gcexportdata?go-get=1获取
从https://golang.org/x/tools/go/gcexportdata?go-get=1解析元标记(状态码200)
获取“golang.org/x/tools/go/gcexportdata”:在https://golang.org/x/tools/go/gcexportdata?go-get=1找到元标记main.metaImport {Prefix:“golang.org/x/tools”,VCS:“git”,RepoRoot:“https://go.googlesource.com/tools”;}
获取“golang.org/x/tools/go/gcexportdata”:验证非权威元标记
从https://golang.org/x/tools?go-get=1获取
从https://golang.org/x/tools?go-get=1解析元标记(状态码200)
golang.org/x/tools(下载)
#cd C:\ Users \ user \ go \ src \ golang.org \ x \ tools; git pull --ff-only
致命:不是git存储库(或任何父目录之一):.git
包golang.org/x/tools/go/gcexportdata:退出状态128
github.com / golang / lint(下载)
从https://golang.org/x/tools/go/gcexportdata?go-get=1获取
从https://golang.org/x/tools/go/gcexportdata?go-get=1解析元标记(状态码200)
获取“golang.org/x/tools/go/gcexportdata”:在https://golang.org/x/tools/go/gcexportdata?go-get=1找到元标记main.metaImport {Prefix:“golang.org/x/tools”,VCS:“git”,RepoRoot:“https://go.googlesource.com/tools”;}
获取“golang.org/x/tools/go/gcexportdata”:验证非权威元标记
从https://golang.org/x/tools?go-get=1获取
从https://golang.org/x/tools?go-get=1解析元标记(状态码200)
golang.org/x/tools(下载)
#cd C:\ Users \ user \ go \ src \ golang.org \ x \ tools; git pull --ff-only
致命:不是git存储库(或任何父目录之一):.git
包golang.org/x/tools/go/gcexportdata:退出状态128
gotests:
错误:命令失败:C:\ Go \ bin \ go.exe get -u -v github.com / cweill / gotests / ...
github.com / cweill / gotests(下载)
从https://golang.org/x/tools/imports?go-get=1获取
从https://golang.org/x/tools/imports?go-get=1解析元标记(状态码200)
获取“golang.org/x/tools/imports”:在https://golang.org/x/tools/imports?go-get=1找到元标记main.metaImport {Prefix:“golang.org/x/tools”,VCS:“git”,RepoRoot:“https://go.googlesource.com/tools”;}
获取“golang.org/x/tools/imports”:验证非权威元标记
从https://golang.org/x/tools?go-get=1获取
从https://golang.org/x/tools?go-get=1解析元标记(状态码200)
golang.org/x/tools(下载)
#cd C:\ Users \ user \ go \ src \ golang.org \ x \ tools; git pull --ff-only
致命:不是git存储库(或任何父目录之一):.git
包golang.org/x/tools/imports:退出状态128
github.com / cweill / gotests(下载)
从https://golang.org/x/tools/imports?go-get=1获取
从https://golang.org/x/tools/imports?go-get=1解析元标记(状态码200)
获取“golang.org/x/tools/imports”:在https://golang.org/x/tools/imports?go-get=1找到元标记main.metaImport {Prefix:“golang.org/x/tools”,VCS:“git”,RepoRoot:“https://go.googlesource.com/tools”;}
获取“golang.org/x/tools/imports”:验证非权威元标记
从https://golang.org/x/tools?go-get=1获取
从https://golang.org/x/tools?go-get=1解析元标记(状态码200)
golang.org/x/tools(下载)
#cd C:\ Users \ user \ go \ src \ golang.org \ x \ tools; git pull --ff-only
致命:不是git存储库(或任何父目录之一):.git
包golang.org/x/tools/imports:退出状态128
有些工具可以安装,而其他工具则无法安装。我无法解决“Not a git repository”错误,因为这是一个自动化过程,我不是在键入git命令。
我尝试在PowerShell中单独安装这些工具,结果出现相同的错误。我的go目录已经创建(在%USERPROFILE%\go
中),并且GOPATH
设置正确。
有什么想法吗?
英文:
I try to start using Go in VSCode. I've installed Go as well as Git and created a project in Code, containing a single .go
file.
When I type something, VSCode warns me that tools like golint
are missing and prompts me to install them. I click on "Install all".
Then the console shows this :
Installing 10 tools
gocode
gopkgs
go-outline
go-symbols
guru
gorename
godef
goreturns
golint
gotests
Installing gocode SUCCEEDED
Installing gopkgs SUCCEEDED
Installing go-outline SUCCEEDED
Installing go-symbols FAILED
Installing guru FAILED
Installing gorename FAILED
Installing godef SUCCEEDED
Installing goreturns FAILED
Installing golint FAILED
Installing gotests FAILED
6 tools failed to install.
go-symbols:
Error: Command failed: C:\Go\bin\go.exe get -u -v github.com/newhook/go-symbols
github.com/newhook/go-symbols (download)
Fetching https://golang.org/x/tools/go/buildutil?go-get=1
Parsing meta tags from https://golang.org/x/tools/go/buildutil?go-get=1 (status code 200)
get "golang.org/x/tools/go/buildutil": 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/buildutil?go-get=1
get "golang.org/x/tools/go/buildutil": 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)
# cd C:\Users\user\go\src\golang.org\x\tools; git pull --ff-only
fatal: Not a git repository (or any of the parent directories): .git
package golang.org/x/tools/go/buildutil: exit status 128
github.com/newhook/go-symbols (download)
Fetching https://golang.org/x/tools/go/buildutil?go-get=1
Parsing meta tags from https://golang.org/x/tools/go/buildutil?go-get=1 (status code 200)
get "golang.org/x/tools/go/buildutil": 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/buildutil?go-get=1
get "golang.org/x/tools/go/buildutil": 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)
# cd C:\Users\user\go\src\golang.org\x\tools; git pull --ff-only
fatal: Not a git repository (or any of the parent directories): .git
package golang.org/x/tools/go/buildutil: exit status 128
guru:
Error: Command failed: C:\Go\bin\go.exe get -u -v golang.org/x/tools/cmd/guru
Fetching https://golang.org/x/tools/cmd/guru?go-get=1
Parsing meta tags from https://golang.org/x/tools/cmd/guru?go-get=1 (status code 200)
get "golang.org/x/tools/cmd/guru": found meta tag main.metaImport{Prefix:"golang.org/x/tools", VCS:"git", RepoRoot:"https://go.googlesource.com/tools"} at https://golang.org/x/tools/cmd/guru?go-get=1
get "golang.org/x/tools/cmd/guru": 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)
# cd C:\Users\user\go\src\golang.org\x\tools; git pull --ff-only
fatal: Not a git repository (or any of the parent directories): .git
package golang.org/x/tools/cmd/guru: exit status 128
Fetching https://golang.org/x/tools/cmd/guru?go-get=1
Parsing meta tags from https://golang.org/x/tools/cmd/guru?go-get=1 (status code 200)
get "golang.org/x/tools/cmd/guru": found meta tag main.metaImport{Prefix:"golang.org/x/tools", VCS:"git", RepoRoot:"https://go.googlesource.com/tools"} at https://golang.org/x/tools/cmd/guru?go-get=1
get "golang.org/x/tools/cmd/guru": 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)
# cd C:\Users\user\go\src\golang.org\x\tools; git pull --ff-only
fatal: Not a git repository (or any of the parent directories): .git
package golang.org/x/tools/cmd/guru: exit status 128
gorename:
Error: Command failed: C:\Go\bin\go.exe get -u -v golang.org/x/tools/cmd/gorename
Fetching https://golang.org/x/tools/cmd/gorename?go-get=1
Parsing meta tags from https://golang.org/x/tools/cmd/gorename?go-get=1 (status code 200)
get "golang.org/x/tools/cmd/gorename": found meta tag main.metaImport{Prefix:"golang.org/x/tools", VCS:"git", RepoRoot:"https://go.googlesource.com/tools"} at https://golang.org/x/tools/cmd/gorename?go-get=1
get "golang.org/x/tools/cmd/gorename": 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)
# cd C:\Users\user\go\src\golang.org\x\tools; git pull --ff-only
fatal: Not a git repository (or any of the parent directories): .git
package golang.org/x/tools/cmd/gorename: exit status 128
Fetching https://golang.org/x/tools/cmd/gorename?go-get=1
Parsing meta tags from https://golang.org/x/tools/cmd/gorename?go-get=1 (status code 200)
get "golang.org/x/tools/cmd/gorename": found meta tag main.metaImport{Prefix:"golang.org/x/tools", VCS:"git", RepoRoot:"https://go.googlesource.com/tools"} at https://golang.org/x/tools/cmd/gorename?go-get=1
get "golang.org/x/tools/cmd/gorename": 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)
# cd C:\Users\user\go\src\golang.org\x\tools; git pull --ff-only
fatal: Not a git repository (or any of the parent directories): .git
package golang.org/x/tools/cmd/gorename: exit status 128
goreturns:
Error: Command failed: C:\Go\bin\go.exe get -u -v sourcegraph.com/sqs/goreturns
Fetching https://sourcegraph.com/sqs/goreturns?go-get=1
Parsing meta tags from https://sourcegraph.com/sqs/goreturns?go-get=1 (status code 200)
get "sourcegraph.com/sqs/goreturns": found meta tag main.metaImport{Prefix:"sourcegraph.com/sqs/goreturns", VCS:"git", RepoRoot:"https://github.com/sqs/goreturns"} at https://sourcegraph.com/sqs/goreturns?go-get=1
sourcegraph.com/sqs/goreturns (download)
github.com/sqs/goreturns (download)
Fetching https://golang.org/x/tools/imports?go-get=1
Parsing meta tags from https://golang.org/x/tools/imports?go-get=1 (status code 200)
get "golang.org/x/tools/imports": found meta tag main.metaImport{Prefix:"golang.org/x/tools", VCS:"git", RepoRoot:"https://go.googlesource.com/tools"} at https://golang.org/x/tools/imports?go-get=1
get "golang.org/x/tools/imports": 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)
# cd C:\Users\user\go\src\golang.org\x\tools; git pull --ff-only
fatal: Not a git repository (or any of the parent directories): .git
package golang.org/x/tools/imports: exit status 128
Fetching https://sourcegraph.com/sqs/goreturns?go-get=1
Parsing meta tags from https://sourcegraph.com/sqs/goreturns?go-get=1 (status code 200)
get "sourcegraph.com/sqs/goreturns": found meta tag main.metaImport{Prefix:"sourcegraph.com/sqs/goreturns", VCS:"git", RepoRoot:"https://github.com/sqs/goreturns"} at https://sourcegraph.com/sqs/goreturns?go-get=1
sourcegraph.com/sqs/goreturns (download)
github.com/sqs/goreturns (download)
Fetching https://golang.org/x/tools/imports?go-get=1
Parsing meta tags from https://golang.org/x/tools/imports?go-get=1 (status code 200)
get "golang.org/x/tools/imports": found meta tag main.metaImport{Prefix:"golang.org/x/tools", VCS:"git", RepoRoot:"https://go.googlesource.com/tools"} at https://golang.org/x/tools/imports?go-get=1
get "golang.org/x/tools/imports": 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)
# cd C:\Users\user\go\src\golang.org\x\tools; git pull --ff-only
fatal: Not a git repository (or any of the parent directories): .git
package golang.org/x/tools/imports: exit status 128
golint:
Error: Command failed: C:\Go\bin\go.exe get -u -v github.com/golang/lint/golint
github.com/golang/lint (download)
Fetching https://golang.org/x/tools/go/gcexportdata?go-get=1
Parsing meta tags from https://golang.org/x/tools/go/gcexportdata?go-get=1 (status code 200)
get "golang.org/x/tools/go/gcexportdata": 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/gcexportdata?go-get=1
get "golang.org/x/tools/go/gcexportdata": 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)
# cd C:\Users\user\go\src\golang.org\x\tools; git pull --ff-only
fatal: Not a git repository (or any of the parent directories): .git
package golang.org/x/tools/go/gcexportdata: exit status 128
github.com/golang/lint (download)
Fetching https://golang.org/x/tools/go/gcexportdata?go-get=1
Parsing meta tags from https://golang.org/x/tools/go/gcexportdata?go-get=1 (status code 200)
get "golang.org/x/tools/go/gcexportdata": 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/gcexportdata?go-get=1
get "golang.org/x/tools/go/gcexportdata": 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)
# cd C:\Users\user\go\src\golang.org\x\tools; git pull --ff-only
fatal: Not a git repository (or any of the parent directories): .git
package golang.org/x/tools/go/gcexportdata: exit status 128
gotests:
Error: Command failed: C:\Go\bin\go.exe get -u -v github.com/cweill/gotests/...
github.com/cweill/gotests (download)
Fetching https://golang.org/x/tools/imports?go-get=1
Parsing meta tags from https://golang.org/x/tools/imports?go-get=1 (status code 200)
get "golang.org/x/tools/imports": found meta tag main.metaImport{Prefix:"golang.org/x/tools", VCS:"git", RepoRoot:"https://go.googlesource.com/tools"} at https://golang.org/x/tools/imports?go-get=1
get "golang.org/x/tools/imports": 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)
# cd C:\Users\user\go\src\golang.org\x\tools; git pull --ff-only
fatal: Not a git repository (or any of the parent directories): .git
package golang.org/x/tools/imports: exit status 128
github.com/cweill/gotests (download)
Fetching https://golang.org/x/tools/imports?go-get=1
Parsing meta tags from https://golang.org/x/tools/imports?go-get=1 (status code 200)
get "golang.org/x/tools/imports": found meta tag main.metaImport{Prefix:"golang.org/x/tools", VCS:"git", RepoRoot:"https://go.googlesource.com/tools"} at https://golang.org/x/tools/imports?go-get=1
get "golang.org/x/tools/imports": 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)
# cd C:\Users\user\go\src\golang.org\x\tools; git pull --ff-only
fatal: Not a git repository (or any of the parent directories): .git
package golang.org/x/tools/imports: exit status 128
Some tools are able to install, others are not. I can't do anything about the Not a git repository
error because it's an automated process and I'm not the one typing the git commands.
I tried installing the tools separately in PowerShell and I get the same errors. My go directory is created (in %USERPROFILE%\go
) and the GOPATH
is set correctly.
Any ideas ?
答案1
得分: 13
看起来它在抱怨C:\Users\user\go\src\golang.org\x\tools
不是一个git仓库,所以它无法更新其中的内容。
假设你没有将自己的代码放在那个目录中,请尝试将其删除,然后再次运行。
如果你查看Go插件的文档,并滚动到底部,它会显示如果你想要手动安装/升级插件所需的内容的命令。
具体来说,从他们的GitHub仓库中获取,你可以在cmd.exe提示符下运行以下命令:
go get -u -v github.com/nsf/gocode
go get -u -v github.com/rogpeppe/godef
go get -u -v github.com/zmb3/gogetdoc
go get -u -v github.com/golang/lint/golint
go get -u -v github.com/lukehoban/go-outline
go get -u -v sourcegraph.com/sqs/goreturns
go get -u -v golang.org/x/tools/cmd/gorename
go get -u -v github.com/tpng/gopkgs
go get -u -v github.com/newhook/go-symbols
go get -u -v golang.org/x/tools/cmd/guru
go get -u -v github.com/cweill/gotests/...
go get -u -v golang.org/x/tools/cmd/godoc
go get -u -v github.com/fatih/gomodifytags
英文:
It looks like it's complaining due to C:\Users\user\go\src\golang.org\x\tools
being not a git repo, so it can't update whatever is in it.
Assuming you didn't put your own code in that dir, try removing it and then running again.
If you look at the docs for the Go plugin, and scroll all the way to the bottom, it shows the commands to run if you want to manually install/upgrade the stuff the plugin needs.
Specifically, taken from their github repo, you can just run this from a cmd.exe prompt.
go get -u -v github.com/nsf/gocode
go get -u -v github.com/rogpeppe/godef
go get -u -v github.com/zmb3/gogetdoc
go get -u -v github.com/golang/lint/golint
go get -u -v github.com/lukehoban/go-outline
go get -u -v sourcegraph.com/sqs/goreturns
go get -u -v golang.org/x/tools/cmd/gorename
go get -u -v github.com/tpng/gopkgs
go get -u -v github.com/newhook/go-symbols
go get -u -v golang.org/x/tools/cmd/guru
go get -u -v github.com/cweill/gotests/...
go get -u -v golang.org/x/tools/cmd/godoc
go get -u -v github.com/fatih/gomodifytags
答案2
得分: 3
解决方案: 只需退出应用程序并以管理员身份重新启动应用程序(以管理员身份运行)。它将正常工作,并且每个模块/依赖项都将成功安装。
英文:
Solution: Just Exit the app & Restart the application as Admin (Run as Administrator). It'll work fine & every module/dependency will be installed Successfully.
答案3
得分: 0
你可能正在运行一个旧版本的Go。
尝试删除你的版本,并从Go的官网安装最新版本。
英文:
You might be running an old version of Go.
Try removing your version and install the latest version from Go's site.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论