Skip to content
Related Articles
Get the best out of our app
GeeksforGeeks App
Open App

Related Articles

How to Install Golang Debugger?

Improve Article
Save Article
Like Article
Improve Article
Save Article
Like Article

Installing a golang debugger is a powerful step for detecting or analyzing and removing existing and potential errors (bugs) in any software type code which can even cause it to behave unusually or it may cause a crash.

To prevent our software /system from these incorrect operations and unusual working we use debugging tools to find and resolve these types of bugs. Hence, Go-Devel is a debugging tool (called a debugger) that is used to find coding errors at various stages of development. We recommend you to use Delve golang debugger as it is the best and powerful debugger tool and simple to use. Delve is a third-party debugger that is used for go programming languages and it’s available on GitHub.

Installing golang debugger

How to download and install go Delve golang debugger:

The command which we have mentioned below works in Linux, Windows and OSX.

Step 1: Go delve can be easily downloaded and installed just by using the go get command inside a workspace but if you are using go modules then you might have to execute this command (in the image below) outside the project directory so as to avoid Delve being added inside your go mod file which has been executed now.

Installing Go delve

devel go get

After running the above command delve debugger will be installed in your workspace and your screen with look like this:

Step  2. After debugging the delve command you can take help from the ‘help’ command option. If you will type help for a list of commands (for further debugging).


The list of commands that will appear on your screen will look like this:

delve help option

Step  3. If you want to get the help command option then you can use dlv quit/ clear command, this command will take you back to the place you were before.

As you have a working go installation then the following should be already setup:

   • Always make sure that the global environment variable are set perfectly because this will indicate the directory where the command dlv dalvi is to be stored. You can also check this by just typing go env GOB IN.

   • And also make sure that the path containing GOV IN which makes run go binary executables without absolute path specification.

While installing in in OSX you may also need to enable the developer tools by running the following command:

xcode-select --install

Then we need to install the legacy include:


Clone the repository into:


Run the below command to install this:

make run

This command will allow you to install delve golang debugger inside OSX.

For checking the installation of the Delve golang debugger you can follow the given steps:

To check whether the developer is installed or not after completing all the steps of the installation the ways to check the installation by the version of the developer.

$dlv version
Delve debugger
Version 1.5.1
Build: $ Id: bca418ea7ae2a4dcda985e623625da727d4525d5 $

Using this command you can check the version of your debugger. Hence, the installation will also be verified.

Some useful commands in Delve golang debugger used while installing:

  • (dlv)debug and (dlv)exec command:

The commands which are important for us to know right now are

dlv debug and 
dlv exec 

these commands are used to start a developing session, the only difference is that one (dlv debug) can easily compile the binary from the source while the other (dlv exec) might have a compiled binary.

  • Test command:

The test command is also a very useful and needy command if we want to debug a go text inside a workspace.

  • Clear command:

This command is used to remove a specific breakpoint from the debugging session or workspace on specified places.

dlv clear 1
Breakpoint 1 cleared at 0 ×10d155d for main.main( ). /main. Go.10

This command is useful if you want to remove a given breakpoint that you have added mistakenly or you just need to remove it from the session or some other area of the program.

  • Clear all command:

This Command is used to clean up all breakpoints that were added manually. It clears all the previous commands or work which was done inside your workspace or debugging session and you can again start from a clear page.

dlv(clear all)
  • Exit command:

If you are stuck in debugging session then you can exit using this command. This command will clear all the running commands.



These sets of commands will be more than enough for you, for installing and further processing of a go application. We have listed the ways of installing delve golang debugger, the commands which are useful while installing debugger and the uses of installing it. It will also help you to you work even easier with other editor integrated versions that follow the same concept and version.

My Personal Notes arrow_drop_up
Last Updated : 09 Nov, 2021
Like Article
Save Article
Similar Reads