Articles useful for 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)
    • 1) Install Gocode

      go get -u -v github.com/nsf/gocode

      2) Install Godef

      go get -u -v github.com/rogpeppe/godef

      3) Install Golint

      go get -u -v github.com/golang/lint/golint

      4) Install Go-find-references

      go get -u -v github.com/lukehoban/go-find-references

      5) Install Go-outline

      go get -u -v github.com/lukehoban/go-outline

      6) Install Goreturns

      go get -u -v sourcegraph.com/sqs/goreturns

      7) Install Gorename

      go get -u -v golang.org/x/tools/cmd/gorename

  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 the selection will scan the expansion pack, this process will be slow, and so on after the expansion package list to choose Go.
      4. Select the Go language and the bottom right corner will prompt

      5. Click on the tip above to see this prompt, click Install (The best sail in this 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 (need to install git in advance)
      7. Move the cloned Tools folder to C:\Go\ The
      8. vs code itself does not debug go codes, it needs to install the Go delve plugin to debug.

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.