Open kdeng opened 6 years ago
Of course, in order to use Go in VS code, you need to install Go extension for VScode.
Also, I configure GOPATH and GOROOT as below.
export GOROOT=/usr/local/bin/go
export GOPATH="$HOME/go"
Also, installing following packages will enable IntelliSense for a variable according to issue.
go get -u -v github.com/nsf/gocode
go get -u -v github.com/rogpeppe/godef
go get -u -v github.com/golang/lint/golint
go get -u -v github.com/lukehoban/go-outline
go get -u -v sourcegraph.com/sqs/goreturns
go get -u -v golang.org/x/tools/cmd/gorename
go get -u -v github.com/tpng/gopkgs
go get -u -v github.com/newhook/go-symbols
go get -u -v golang.org/x/tools/cmd/guru
Also, I have set up USER SETTINGS
of VS code to enable current workspace as a part of GOPATH.
{
"go.docsTool": "gogetdoc",
"go.buildOnSave": true,
"go.lintOnSave": true,
"go.vetOnSave": true,
"go.buildTags": "",
"go.buildFlags": [],
"go.lintFlags": [],
"go.vetFlags": [],
"go.coverOnSave": false,
"go.useCodeSnippetsOnFunctionSuggest": false,
"go.formatOnSave": true,
"go.formatTool": "goreturns",
"go.goroot": "/usr/local/opt/go/libexec",
"go.gopath": "/Users/kefeng.deng/go:${workspaceFolder}",
"go.gocodeAutoBuild": false,
}
So, until now, you will be able to develop Go with VS Code.
It is already a week now since I decided to develop a new GAE service in Go.
I am mainly using vscode instead of other IDEs, as I would like to learn how to set up Go development environment from scratch.
I am learning the things during my development work, so it slows down my development process, but I find it actually helps me to understand the concepts during the real situation, instead of following the tutorial as a robot.
I will keep adding comments on this issue, and I hope it can help someone like me, and receive some feedback if there is a better approach.