使用 Visual Studio Code 开发 Go


设置 Windows 环境变量:

GOPATH = E:\Soft\GoPath
GOROOT = C:\Program Files\Go
Path = %SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem;%SYSTEMROOT%\System32\WindowsPowerShell\v1.0\;C:\Program Files\TortoiseSVN\bin;C:\Program Files\Git\cmd;C:\Program Files\Git\mingw64\bin;C:\Program Files\Git\usr\bin;C:\Program Files\Python\;C:\Program Files\Python\Scripts;C:\Program Files\Go\bin;

安装 Go 插件:

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-find-references
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

编辑插件:

{
    "window.zoomLevel": 0,
    "editor.tabSize": 4,
    "editor.fontSize": 16,
    "editor.wordWrap": "on",
    "editor.lineHeight": 24,
    "editor.lineNumbers": "on",
    "editor.minimap.enabled": false,
    "editor.minimap.renderCharacters": false,
    "editor.detectIndentation": true,
    "editor.largeFileOptimizations": false,
    "workbench.colorTheme": "Solarized Dark",
    "workbench.iconTheme": "vscode-icons",
    "workbench.startupEditor": "newUntitledFile",
    "go.gopath": "E:\\Soft\\GoPath",
    "go.goroot": "E:\\Soft\\Go",
    "go.docsTool": "gogetdoc",
    "go.lintOnSave": "package",
    "go.lintFlags": [],
    "go.vetOnSave": "package",
    "go.vetFlags": [],
    "go.coverOnSave": false,
    "go.formatOnSave": true,
    "go.formatTool": "goreturns",
    "go.useCodeSnippetsOnFunctionSuggest": false,
    "go.buildOnSave": "off",
    "go.buildTags": "",
    "go.buildFlags": [],
    "go.gocodeAutoBuild": false,
}
分享:

评论