Vscode configuration Go environment can be debugged

Source: Internet
Author: User
Tags install go gocode

1. Go download Install and configure environment variables

2. Installation tools:

1) Install Gocode

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

2) Install Godef

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

3) Install Golint

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

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

7) Install Gorename

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

(3) Visual Studio Code supports go language debugging to execute the following commands:

      1. Go get-v-u github.com/peterh/liner github.com/derekparker/delve/cmd/dlv
      2. Brew Install go-delve/delve/delve
      3. go get-v-u github.com/peterh/liner github.com/derekparker/delve/cmd/dlv
    Modify the "Dlv-cert" certificate

    1. Turn on "Keychain Access"
    2. Open menu, Keychain Access, certificate Assistant, create a certificate
    3. Name: DIv identity Type: Self-signed certificate certificate type: Code signing and select "Let me override these defaults"
    4. Click "Continue", there is a deadline (days): 365, you can modify, 3650
    5. Continue until you see the "Specify a location for this certificate" keychain, select "System" and click the "Create" button
    6. Restart the Finder, then open keychain Access, select System, and you will see the created "Dlv-cert" certificate
    7. Right-click the "Dlv-cert" certificate, and select "Show Introduction-, trust-and code signing" to: Always Trust
    8. Open the terminal and go to the $GOPATH/src dlv source file directory under the previously installed directory: Github.com/derekparker/delve
    9. Enter the following command to recompile a DLV executing program with code signature

    GO15VENDOREXPERIMENT=1 CERT=dlv-cert make install

Problems that you may encounter

The execution file "./dlv-h" always return >> Killed:9

StackOverflow Solution:

  1. I need to does this step below
  2. Brew Install go-delve/delve/delve
  3. and go to $GOPATH/src/github.com/derekparker
  4. Git clone https://github.com/derekparker/delve.git
  5. Cert=dlv-cert make Install
  6. (Remove old dlv > Brew Install delve > codesign dlv)
  7. Not just run
  8. go get github.com/derekparker/delve/cmd/dlv
  9. and it works now.

Restart Visual Studio Code to make the perfect use of the

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.