gocode不能自动补全
#安装gocode
go get -u github.com/nsf/gocode (-u flag for "update")
#Windows系统安装gocode
go get -u -ldflags -H=windowsgui github.com/nsf/gocode
$ gocode --help
Usage: E:\goRepo\bin\gocode.exe [-s] [-f=<format>] [-in=<path>] [-sock=<type>] [-addr=<addr>]
<command> [<args>]
Flags:
-addr string
address for tcp socket (default "127.0.0.1:37373")
-debug
enable server-side debug mode
-f string
output format (vim | emacs | nice | csv | csv-with-package | json) (default "nice")
-in string
use this file instead of stdin input
-profile int
port on which to expose profiling information for pprof; 0 to disable profiling
-s run a server instead of a client
-sock string
socket type (unix | tcp) (default "tcp")
Commands:
autocomplete [<path>] <offset> main autocompletion command
close close the gocode daemon
drop-cache drop gocode daemon's cache
options list config options (extended)
set [<name> [<value>]] list or set config options
status gocode daemon status report
安装vscode
安装vscode-go 插件
进入vscode界面,打开命令面板Ctrl + Shift + P
,输入install
Completion Lists (using gocode)
Signature Help (using godoc)
Snippets
Quick Info (using godef)
Goto Definition (using godef)
Find References (using guru)
File outline (using go-outline)
Workspace symbol search (using go-symbols)
Rename (using gorename)
Build-on-save (using go build and go test)
Lint-on-save (using golint or gometalinter)
Format (using goreturns or goimports or gofmt)
Generate unit tests squeleton (using gotests)
Add Imports (using gopkgs)
[partially implemented] Debugging (using delve)
golang.org/x/xxx
包的手动安装方法:
golang.org/x/xxx
这类包托管在 github.com/golang
,从这里找到相应的包即可。比如 golang.org/x/crypto
包的安装,找到对应的地址为: https://github.com/golang/crypto
, 运行以下命令:
$ cd $GOPATH/src
$ mkdir golang.org
$ cd golang.org
$ mkdir x
$ cd x
$ git clone https://github.com/golang/crypto.git
go get -u -v github.com/golang/tools
go get -u -v github.com/golang/lint
go get -u -v github.com/nsf/gocode
go get -u -v github.com/rogpeppe/godef
go get -u -v github.com/lukehoban/go-outline
go get -u -v github.com/sqs/goreturns
go get -u -v github.com/tpng/gopkgs
go get -u -v github.com/newhook/go-symbols
go get -u -v github.com/cweill/gotests
命令面板 Ctrl + Shift + P
转到文件 Ctrl + P
切换终端 Ctrl + `