go get -v -d -u github.com/nsf/gocode go get -v -d -u github.com/uudashr/gopkgs/cmd/gopkgs go get -v -d -u github.com/ramya-rao-a/go-outline go get -v -d -u github.com/acroca/go-symbols go get -v -d -u golang.org/x/tools/cmd/guru go get -v -d -u golang.org/x/tools/cmd/gorename go get -v -d -u github.com/fatih/gomodifytags go get -v -d -u github.com/josharian/impl go get -v -d -u github.com/zmb3/gogetdoc go get -v -d -u sourcegraph.com/sqs/goreturns go get -v -d -u github.com/golang/lint/golint go get -v -d -u github.com/cweill/gotests/...
go get -v -d -u github.com/nsf/gocode go get -v -d -u github.com/uudashr/gopkgs/cmd/gopkgs go get -v -d -u github.com/ramya-rao-a/go-outline go get -v -d -u github.com/acroca/go-symbols go get -v -d -u golang.org/x/tools/cmd/guru go get -v -d -u golang.org/x/tools/cmd/gorename go get -v -d -u github.com/fatih/gomodifytags go get -v -d -u github.com/josharian/impl go get -v -d -u github.com/zmb3/gogetdoc go get -v -d -u sourcegraph.com/sqs/goreturns go get -v -d -u github.com/golang/lint/golint go get -v -d -u github.com/cweill/gotests/... }
pack() { cd ./gopath local name=$(generate_name) zip -qr - . | pv > ../vscode_go_deps.$name.zip cd .. shasum -a 256 vscode_go_deps.$name.zip > vscode_go_deps.$name.sha256sum }
unpack() { if [ -z "$1" ]; then echo"Usage: unpack <vscode_go_deps.zip> [GOPATH]" return 1 fi
local gopath=${2:-$GOPATH} if [ -z "$gopath" ]; then echo"ERROR: Cannot find GOPATH to unzip the dependencies." echo"Usage: unpack <vscode_go_deps.zip> [GOPATH]" return 1 fi
local checksum=${1%%.zip}.sha256sum if [ -f "$checksum" ]; then shasum -a 256 -c $checksum fi
go install github.com/nsf/gocode go install github.com/uudashr/gopkgs/cmd/gopkgs go install github.com/ramya-rao-a/go-outline go install github.com/acroca/go-symbols go install golang.org/x/tools/cmd/guru go install golang.org/x/tools/cmd/gorename go install github.com/fatih/gomodifytags go install github.com/josharian/impl go install github.com/zmb3/gogetdoc go install sourcegraph.com/sqs/goreturns go install github.com/golang/lint/golint go install github.com/cweill/gotests/... }
clean() { rm -rf ./gopath }
command=$1 shift $command"$@"
然后 sudo run.sh install, 生成完毕可以看到:
btw: 也可以自己打包,使用 run.sh get 以及 run.sh pack,请直接看上面的脚本。
之后能使用的插件,大致上如下:(当然也可以直接在命令行里面使用)
Go: Add Import to add an import from the list of packages in your Go context
Go: Current GOPATH to see your currently configured GOPATH
Go: Test at cursor to run a test at the current cursor position in the active document
Go: Test Package to run all tests in the package containing the active document
Go: Test File to run all tests in the current active document
Go: Test Previous to run the previously run test command
Go: Test All Packages in Workspace to run all tests in the current workspace
Go: Generates unit tests for package Generates unit tests for the current package
Go: Generates unit tests for file Generates unit tests for the current file
Go: Generates unit tests for function Generates unit tests for the selected function in the current file
Go: Install Tools Installs/updates all the Go tools that the extension depends on
Go: Add Tags Adds configured tags to selected struct fields.
Go: Remove Tags Removes configured tags from selected struct fields.
Go: Generate Interface Stubs Generates method stubs for given interface
Go: Run on Go Playground Upload the current selection or file to the Go Playground