edo1z blog

プログラミングなどに関するブログです

Go言語 - godefがインストールできない

Goのバージョン

$ go version
go version go1.8 windows/amd64

godefインストールエラー

vimのプラグインとかvscodeとかで、godefをインストールするようにいわれるけど、失敗する。下記のようなエラーがでる。

Error: Command failed: D:\Go\bin\go.exe get -u -v github.com/rogpeppe/godef
github.com/rogpeppe/godef (download)
# cd C:\Users\hoge\go\src\github.com\rogpeppe\godef; git pull --ff-only
There is no tracking information for the current branch.
Please specify which branch you want to merge with.
See git-pull(1) for details.

    git pull <remote> <branch>

If you wish to set tracking information for this branch you can do so with:

    git branch --set-upstream-to=origin/<branch> master

package github.com/rogpeppe/godef: exit status 1
github.com/rogpeppe/godef (download)
# cd C:\Users\hoge\go\src\github.com\rogpeppe\godef; git pull --ff-only
There is no tracking information for the current branch.
Please specify which branch you want to merge with.
See git-pull(1) for details.

    git pull <remote> <branch>

If you wish to set tracking information for this branch you can do so with:

    git branch --set-upstream-to=origin/<branch> master

解決策

$GOPATH/src/github.com/rogpeppe/godefが存在して、その中には.gitフォルダだけある。中途半端で止まってしまったのだろうか。

下記をしたら、プルできて色んなファイルが出てきた。

$ git pull origin master

再度インストールしてみたら、エラーがなくなった。

$ go get github.com/rogpeppe/godef