Premise 0.

Execute in $GOPATH:

$ git clone https://github.com/golang/lint.git src/golang.org/x/lint
$ go install golang.org/x/lint
$ git clone https://github.com/golang/tools.git src/golang.org/x/tools
$ git clone https://github.com/golang/sync.git src/golang.org/x/sync
$ git clone https://github.com/golang/net.git src/golang.org/x/net
$ git clone https://github.com/golang/xerrors.git src/golang.org/x/xerrors
$ go install golang.org/x/tools/...
Copy the code

PS: This step is because some of the tools installation in Vim-Go was pulled from Golang.org, but for GFW reasons, you know. So you need to download it from Github first. (Google is very considerate.)

1. Install

I’m using Vundle, so add: Plugin ‘fatih/vim-go’ to the ~/.vimrc file accordingly and save and exit.

Open Vim, then execute :GoInstallBinaries and wait for the installation to complete.

2. Use and attention

Code prompt shortcut keys: Ctrl+ X + O;

Note: To use the code prompt, you need the corresponding xxx.go file in $GOPATH/ SRC /xxx_package, otherwise there is no code prompt. (Don’t ask me how I know…)