Debugging go code with Visual Studio code under Windows

Source: Internet
Author: User
Tags gocode

    1. Http://www.golangtc.com/download downloading an installation package or a compressed package
    2. Configuring Environment variables
      1. Configuration goroot:

         
      2. Configure path: Last added in Path

      3. Configure the role of Gopath:gopath please Baidu, the specific directory can be defined by their own

    3. Required extensions
      • Code autocomplete (using Gocode)
      • Quick Tip information (using GODEF)
      • Jump to Definition (using GODEF)
      • Search references (using go-find-references)
      • Document Outline (using Go-outline)
      • Renaming (using Gorename)
      • Save build (using Go build and go test)
      • Code formatting (using Goreturns or Goimports or gofmt)
      • Debug code (using delve)
    4. Install the extension (skip this step if you are using Visual Studio Code)
      1. Code completion extension, execution on the command line (example, other plugins same)
        Go get-u-ldflags-h=windowsgui Github.com/nsf/gocode
        Go Install Github.com/nsf/gocode
    5. Install Editor
        1. Download vs code (rating vs code): https://www.visualstudio.com/en-us/products/code-vs.aspx
        2. Press CTRL+SHIFT+P, enter install, select
        3. After selecting the extension package will be scanned, this process will be slow, and so on after the expansion package list to choose Go.
        4. Selecting the Go language will prompt you in the lower right corner

        5. Click on the tips above to see this prompt and click Install (the best sail in the process * * Qiang)

        6. The reinstallation process will report that some extensions under tools are not found. Execute "git clone https://github.com/golang/tools.git" on the command line (requires a pre-installation of Git)
        7. Move the cloned Tools folder to the C:\Go\GOPATH\src\golang.org\x file
        8. Perform 4, 5 steps again. Restart vs Code
        9. The VS code itself does not debug go codes and needs to be installed to debug the Go delve plugin.

        10. On the command line, perform "Go get-u-v github.com/derekparker/delve/cmd/dlv". OK, so you can debug it here.

Debugging go code with Visual Studio code under Windows

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.