-
Clearly explain what you’re trying to do
I want to learn an open source project[1] through debugging (basically to check some values during runtime) its code. But I encounter a problem to setup debugging env in vscode. I suppose I am not familiar with both vscode and golang, so I appreciate any suggestions. -
State the problem and report exact error messages or program behavior
There is no problem to git clone the project and to setup up the break points and so on. However, that project is a client/ server setting. So I am not sure if the way I setup to debug is correct or not.- Click Debug and Run button which creates
launch.json
file with content
{ // Use IntelliSense to learn about possible attributes. // Hover to view descriptions of existing attributes. // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 "version": "0.2.0", "configurations": [ { "name": "Launch Package", "type": "go", "request": "launch", "mode": "auto", "program": "${fileDirname}" } ] }
- vscode’s DEBUG CONSOLE prints
Starting: /home/jason/go/bin/dlv dap --check-go-version=false --listen=127.0.0.1:41767 --log-dest=3 from /home/jason/workspace/github.com/chlin501/serf/.vscode DAP server listening at: 127.0.0.1:41767
- Click Debug and Run button which creates
-
Problems
I do not know how to trigger the entire flow so that I can observe the vlaues during runtime execution. Typically the procedure of this project is to launch a server process by e.g../bin/serf agent -node=foo -bind=127.0.0.1:5000 -rpc-addr=127.0.0.1:7373
; then to issue a client command such as./bin/serf join 127.0.0.1:5001
. Now if I run this in vscode TERMINAL, nothing happens in debug env like simple tutorial where I can observe variables and call stack values at runtime. How should I configure to achieve this goal? Thanks
[1]. GitHub - hashicorp/serf: Service orchestration and management tool.