Major problem:

System environment variable GOBIN cause problem “vim-go error: vim-go: goimports does not support srcdir”


Recently I use vs code to write golang more than vim-go,But when you upgrade the Golang version then use vim-go to save file, it will always popup following error message.

vim-go: goimports does not support srcdir

Problem Environment:

Root Cause:

normally there are two importnt variable in go env which was $GOPATH and $GOBIN. But most user only set $GOPATH but $GOBIN.

It will cause your all golang binary install via go install to the directory $GOPATH/bin.

Recently Homebrew formula, it will help us to set $GOBIN but the path will be/usr/local/Cellar/go/GO_VERSION/libexec/bin rather than $GOPATH/bin.

What’s the problem with that?

  1. If you have any package which force to install in $GOPATH/bin, it might has problem with duplicate or not install latest one with Golang update. dlv has the same issue before,I file a PR for this
  2. If you already install some useful tool in $GOPATH/bin before, it will not update and some problem will occur. As my problem in goimports which is identical with issue 775, I use the old version of goimports so it will occur error in vim-go.)


  • Remove all binary file $GOPATH/bin. (If you always use Homebrew for Golang update)
  • Reinstall all binaries, it will install to correct path in $GOBIN, not $GOPATH/bin.


Attitude is everything