Visual Studio Code--go development tool Configuration

Source: Internet
Author: User
This is a creation in Article, where the information may have evolved or changed. have been looking for a hand in the go language development tools, try a lot of things are not good, listen to Beego author recommended to try the industry conscience Microsoft launched Visual Studio Code to develop do go development is really comfortable, today to summarize the configuration of Visual Studio code-go development tools.


1, need to install the tool go, Visual Studio code,git


Baidu Cloud: Http://pan.baidu.com/s/1i5nW50L Password: EBPC
Cloud Disk: Https://yunpan.cn/c6mGjQf9mU6gE access Password 30ae


2, Go,git, Visual Studio Code installation


Go,git, Visual Studio Code installation is simple and will not be self-Baidu Google


3. Go Environment configuration



Goroot: Is the Go installation path Gopath: Is the development path can be set freely


After configuration is complete, cmd verification




4 . Configuration of Visual Studio code--vscode-go




    1.   open

      visual Studio Code Interface Press shortcut key ctrl+shift+p

    2. Span style= "FONT-SIZE:19.005PX; Line-height:30.408px "> > input install extensions then jump to the window and enter go click install installation
    3.   Vscode-go need to install plug-ins to use all functions properly, these plugins require git installation, which is why we need to download git
    • Open git cmd


    • Copy code paste copy directly to Doc will be installed (may need to flip the wall-The Wall tutorial:)
    • 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-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-symbolsgo get-u-v golang.org/x/tools/cmd/g Urugo Get-u GITHUB.COM/DEREKPARKER/DELVE/CMD/DLV


After the installation is complete, look under your own gopath environment. If you have these files, it means you're successful.


5.Visual Studio code usage and configuration


after the software installation is complete, you need to configure,Configure Go Settings.json
{    "Files.autosave": "Onfocuschange",    "Go.buildonsave": True,    "Go.lintonsave": True,    "Go.vetonsave ": True,    " Go.buildflags ": [],    " go.lintflags ": [],    " go.vetflags ": [],    " Go.formatonsave ": true,    "Go.formattool": "Goreturns",    "Go.goroot": "C:\\go",    "Go.gopath": "E:\\GO\\GOXM"}

If you need to use the Debug function then you also need to configure  Launch.json First Configuration Press F5 select Go now the Go debug is not very good, can only select the Debug folder under, and can not set folder, need to debug that folder under the file configuration that is in
{"    version": "0.2.0",    "Configurations": [        {            "name": "Launch",            "type": "Go",            "request": " Launch ",            " mode ":" Debug ",            " RemotePath ":" ",            " port ": 2345,            " host ":" 127.0.0.1 ",            " program ":" ${ Workspaceroot} ",             //debug path configuration ${workspaceroot}--gopath Path instance: ${workspaceroot}/src            " env ": {},            " args ": []        }    ]}


6, the configuration is ready to use it


Detailed use of tutorials recommended: http://my.oschina.net/iyf/blog/5991121, code hints
2, code highlighting, etc.


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.