Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Debugging GO on VSCode using Delve

I want to debug GoLang on VSCode editor. In their documentation they say it is possible. I am following the following Link to install the debugging features on the IDE. https://marketplace.visualstudio.com/items?itemName=lukehoban.Go

And to install Delve they ask to follow these instructions https://github.com/derekparker/delve/blob/master/Documentation/installation/windows/install.md

Once installation is completed they ask to run the following code

$ mingw32-make install

But there is an error

mingw32-make: *** No rule to make target 'install'. Stop.

Does anybody know whats wrong with this? Has anything changed other than these instructions?

like image 767
Shehan Tis Avatar asked Apr 25 '16 07:04

Shehan Tis


People also ask

How do I debug with Delve?

Debugging your ApplicationAdd a breakpoint at line 10 of our main.go file by running breakpoint main.go:10 (or b main.go:10 for short). Run continue (or c ) to run-to-breakpoint.

How do I run the go program in debug mode?

To debug a program, execute the dlv debug command. Attach the filename at the end of this command, and debugging will start. For example, if you want to debug the main.go file, run the command dlv debug main.go . It is also known as “delve server” because this is a running process waiting for instructions.

How do I debug using VS Code?

Launch configurations. To run or debug a simple app in VS Code, select Run and Debug on the Debug start view or press F5 and VS Code will try to run your currently active file.


1 Answers

I managed to get this resolved. You don't want to install mingw for this. Instead run this code and make sure the dlv.exe which is created in any directory which is in your PATH variable in your computer.

$go get -u github.com/derekparker/delve/cmd/dlv

I also did an writeup about debugging Golang using VSCode and Delve. If you are interested you can read it here.

like image 119
Shehan Tis Avatar answered Sep 21 '22 04:09

Shehan Tis