An Interest In:
Web News this Week
- March 22, 2024
- March 21, 2024
- March 20, 2024
- March 19, 2024
- March 18, 2024
- March 17, 2024
- March 16, 2024
March 23, 2022 02:04 am GMT
Original Link: https://dev.to/huihzhao/how-to-debug-your-go-application-in-vscode-3nfg
How to debug your Go application in VSCode
I am using VScode as my primary editor of coding, and I feel very excited by the VScode ecosystem. However, when I first used it to debug go application, as the debug settings is not that straightforward, I spent one hour to learn how to setup the debug process with VScode.
Before you start, it'd better to install the dlv, the go debugger, manually.
brew install dlv
Validate your dlv installation.
dlv versionDelve DebuggerVersion: 1.8.2Build: $Id: dbb493ec14d1e7753504d016b1e1ef1665b75b16
Then open VSCode in your root directory of your go project. Usually, in the root directory, you can find your main.go, go.mod, and go.sum files.
Open your debug settings, which is a launch.json file saved in your code directory of ".vscode".
Add the following contents:
"version": "0.2.0", "configurations": [ { "name": "Launch file", "type": "go", "request": "launch", "mode": "debug", "program": "main.go", "args": ["arg1", "arg2"] } ]}
Then you can start your debugging by press "F5" now.
Original Link: https://dev.to/huihzhao/how-to-debug-your-go-application-in-vscode-3nfg
Share this article:
Tweet
View Full Article
Dev To
An online community for sharing and discovering great ideas, having debates, and making friendsMore About this Source Visit Dev To