Debugging go code with Visual Studio code under Windows

Source: Internet
Author: User
This is a creation in Article, where the information may have evolved or changed.
    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 selection will scan the expansion pack, this process will be slow, and so on after the extension package list to choose Go.
        4. When you select the go language, the lower-right corner prompts the

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

        6. Reinstall process will not find tools under Some of the extensions. Execute "git clone https://github.com/golang/tools.git" on the command line (you need to install git earlier)
        7. to move the cloned Tools folder to C:\Go\GOPATH\ The
        8. in the src\golang.org\x file performs 4, 5 steps again. Restarting vs code
        9. vs code itself does not debug go code, it needs to install the Go delve plugin to debug.

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

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.