This is a creation in Article, where the information may have evolved or changed.
Background
In the previous article on Deepin Linux with sublime TEXT3 configuration Golang Development environment articles, sublime development with Golang Text 3 was introduced, and the latest Golang development artifact Visual Studio Code is described in this article.
Visual Studio code redefined and optimized code editing to build and debug modern WEB applications and cloud applications. You can use Visual Studio Code for free on common platforms (Linux, OS X, and Windows).
Go language Installation
View more: Install Golang
Vscode Installation
Download the latest version of 1.4.0 and install it from the Visual Studio code website.
Plug-in Installation
In the left navigation bar there are 5 buttons, which are Explorer, search, GIT, Debug, expand, click the Extension button, then search the App Store for extension Go to install the plugin.
Vs-go
After the plugin is installed, restart Visual Studio Code and click the installed plugin again to see the plugin's introduction.
Go for Visual Studio Code
Visual Studio Code Go plug-in configuration options
From the menu, choose "File", "preferences", "User settings" to make the following settings
Settings
// 将设置放入此文件中以覆盖默认设置{ "files.autoSave": "onFocusChange", "go.buildOnSave": true, "go.lintOnSave": true, "go.vetOnSave": true, "go.buildFlags": [], "go.lintFlags": [], "go.vetFlags": [], "go.useCodeSnippetsOnFunctionSuggest": false, "go.formatOnSave": false, "go.formatTool": "goreturns", "go.gopath":"/home/tonny/golang", "go.goroot": "/usr/local/go"}
Go Tool Installation
Since the domestic access to golang.org is not smooth, the use of a flexible way to install the Go tool.
➜ tonny@tonny-pc ~ mkdir -p $GOPATH/src/golang.org/x ➜ tonny@tonny-pc ~ cd $GOPATH/src/golang.org/x➜ tonny@tonny-pc ~ git clone https://github.com/golang/tools.git➜ tonny@tonny-pc ~ go get golang.org/x/tools/cmd/godoc➜ tonny@tonny-pc ~ ll $GOROOT/bin
Other related tools installation, refer to the following:
➜ tonny@tonny-pc ~ vi gotools.sh#!/bin/bash # Get all go tools for vscodego get -u -v github.com/nsf/gocodego get -u -v github.com/rogpeppe/godefgo get -u -v github.com/golang/lint/golintgo get -u -v github.com/lukehoban/go-find-referencesgo get -u -v github.com/lukehoban/go-outlinego get -u -v sourcegraph.com/sqs/goreturnsgo get -u -v golang.org/x/tools/cmd/gorenamego get -u -v github.com/tpng/gopkgsgo get -u -v github.com/newhook/go-symbols➜ tonny@tonny-pc ~ chmod +x gotools.sh ➜ tonny@tonny-pc ~ ./gotools.sh
Debugging Tools DLV
go get github.com/derekparker/delve/cmd/dlv$ make install
Note:if you is using Go 1.5 you must set GO15VENDOREXPERIMENT=1
before continuing. The GO15VENDOREXPERIMENT
env var simply opts into the Go 1.5 Vendor experiment.