Before, it was very convenient to use gocode+vim to write go under Linux. After switching to mac, no matter how I configured it, it was not successful, and I couldn’t achieve it step by step according to the author’s method. Can anyone who has done the same thing help me? Take a look, I wrote down my detailed configuration process.
method one:
Method Two:
Later, I found a relatively comprehensive setting through Google.
https://github.com/astaxie/build-web-... There are many configurations of commonly used tools. After vim is configured, the situation is still the same.
My current system variables:
ajian@localhost:/usr/local/go $go env warning: GOPATH set to GOROOT (/usr/local/go) has no effect GOARCH="amd64" GOBIN="/usr/local/go/bin" GOCHAR="6" GOEXE="" GOGCCFLAGS="-g -O2 -fPIC -m64 -pthread -fno-common" GOHOSTARCH="amd64" GOHOSTOS="darwin" GOOS="darwin" GOPATH="/usr/local/go" GOROOT="/usr/local/go" GOTOOLDIR="/usr/local/go/pkg/tool/darwin_amd64" CGO_ENABLED="1" ajian@localhost:/usr/local/go $gocode set propose-builtins true lib-path "/usr/local/go/pkg/darwin_amd64/"
My vim configuration
ajian@localhost:~ $cat .vimrc """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" " go 配置 """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" set shiftwidth=4 set expandtab set tabstop=4 set softtabstop=4 set completeopt=longest,menu filetype plugin indent on syntax on
Maybe I don’t understand how gocode works. How to debug it? No clue now.
https://bitbucket.org/reckhou/myvim
This is my VIM configuration, you can download it and try it out, it’s for MAC
It’s better to use LiteIDE. Debugging is also very convenient
What does gocode -s output after gocode close?