Using visual Studio code to build the go locale under Windows

Source: Internet
Author: User
Tags install go
This is a creation in Article, where the information may have evolved or changed.

1. Install the Go language

Download Address:     https://golang.org/dl/Run the install Go language directly under Windows. The installation was successful. After installing the Go language, you need to add the GOPATH environment variable, point to your working directory folder, create a new directory yourself alsoFor ease of operation, the bin directory under Gopath can also be added to the end of the PATH environment variable, since the compiled file is placed in the bin in the Gopath directory when the go get command is used
2. Install Gitgit is the main version control tool used in go, need git tool to download address when using go get command: http://git-scm.com/download/generally follow the default setup. Install git complete. 3. Install visual Studio Code Download Address: https://code.visualstudio.com/installation vscode complete. 4, install Nodejs because Vscode Debug go need to use NPM, so here ahead of the installation of Nodejs download address: https://nodejs.org/en/download/So, Nodejs installation is complete. 5. Install plug-in Vscode-go project address: https://github.com/Microsoft/vscode-go Open the command line tool, execute the following command sequentially, install the related components through the source code, Need to ensure that the go language and git are properly installed and that the GOPATH environment variable is set (some source code may need to be fq to get it)
Go 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
  Open Vscode after installation, use the shortcut key Ctrl+shift+p open  install extension   install go plugin   Restart editor after installation   At this time use Vscode open any go file to see if all the necessary components have been successfully installed, if the component is missing, you will be prompted in the lower right corner of analysis Tools missing  at this time check my Gopath bin directory, to see if you have successfully installed all the programs , if a program is missing, refer to "Step n" Using the go Get command to reinstall the appropriate program   open user settings to see the appropriate configuration of the Go plugin      debug the Go language with Vscode:   First make sure to install the mingw-w64  download address:https://sourceforge.net/projects/mingw-w64/  Double-click to install   Install the instructions in the installation process to configure    Add the Bin directory of the Setup program to the PATH environment variable after installation   Use the go get command to install the delve program
    1. go get-v -u github.com/peterh/liner github.com/derekparker/delve/cmd/dlv
After installation, check the bin in the Gopath to see if the Dlv.exe program deletes the Go plugin directory in the current user folder, as it will be installed and debugged using the git command to clone the Vscode-go plugin into any directory.
    1. git clone https://github.com/Microsoft/vscode-go
Use the command line tool to install the Vscode-go source code, please make sure that the installation of Nodejs installed successfully, using the Vscode-go directory to enter the Debug page, press F5 directly run the program, a new Vscode window will be opened, the user calls our own Go working directory Here to create a new working directory, and use Vscode Open enter the Debug page to open the run configuration for the first time you need to choose to run the environment, select Go to see at this time the default configuration as shown in the configuration at this time Vscode automatically created for us,  The. Vscode directory under the working directory to modify the contents of the Run configuration, add a configuration, as follows, we opened a new Vscode window, open the Vscode-go in the Debugadapter directory into the Debug page, press F5 to run directly  At this time to return to the previous open our own working directory, open the need to debug the source code, the next breakpoint, and finally press F5 to debug. Now that the basic go language environment has been set up, you can start writing code at peace of mind.



Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.