Spectrum Chain Development--ide Breakpoint Debugging Introduction

Source: Internet
Author: User

Spectrum Chain Development--ide Breakpoint Debugging Introduction

作者:GirpZhang

Experimental environment

    • Windows10

    • Go1.9.2.windows-amd64

    • Visual Studio Code

    • Git 2.18.0

Need to complete the Visual Studio Code + Golang Development environment configuration

    • Installing GO1.9.2.WINDOWS-AMD64

    • Install Git

    • Install Golang, configure Gopath

      本例中使用的 "GOPATH":"E:/GoPath";"GOROOT":"E:/Go"

    • Install Visual Studio Code, install the Go plugin, and the introduction is Rich Go language support for Visual Studio code

    • Debug Configuration:

      VSCode->查看->调试->添加调试目标,在"没有调试"的下拉框中点击"添加配置.."To add a target Debug configuration:

{    "version": "0.2.0",    "configurations": [        {            "name": "Launch",            "type": "go",            "request": "launch",            "mode": "debug",            "remotePath": "",            "port": 2345,            "host": "127.0.0.1",            "program": "${fileDirname}",            "env": {                "GOPATH":"E:/GoPath",                "GOROOT":"E:/Go"            },            "args": [],            "showLog": true        }    ]}

Download Spectrum Code

git clone git@github.com:SmartMeshFoundation/Spectrum.git

Commissioning Preparation

    • Create a new multilevel directory under E:/GOPATH/SRC: \github.com\smartmeshfoundation\spectrum

    • Copy the code from the downloaded spectrum.git to E:/gopath/src/github.com/smartmeshfoundation/spectrum

    • Open Vscode, select File-open folder, open Spectrum folder

    • Open Cmd->smc->main.go File

    • F5 debugging, you will be prompted with the following error:

Failded to continue:"Cannot find Delve debugger. Install from https://github.com/derekparker/delve & ensure it is in your "GOPATH/bin" or "PATH"
    • Then we use the Go command line to compile the debugger, put the DLV debugger in the Gopath bin directory

      • Use the cmd command line to enter the directory E:\GoPath\bin

      • To perform a command installation DLV

      go get github.com/derekparker/delve/cmd/dlv
    • Then you can debug normally, and place breakpoints on the spot where you need to do one step:

Image
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.