How to set up debugging in GoLand?

前端 未结 6 622
北荒
北荒 2021-02-07 04:20

I am trying out GoLand and hear that the debugger is supposedly awesome, but I can’t find any documentation explaining how to set it up (GoLand is in preview stage, so that’s no

6条回答
  •  谎友^
    谎友^ (楼主)
    2021-02-07 05:01

    I was facing this same issue and I solved by using the "Go Application" configuration (at the Run/Debug Configurations window), instead of the "Go Single File" configuration.

    So, go to the upper right corner of the Gogland and "Edit configurations".

    Then, add a new configuration using the "Go Application" profile.

    After saving, you should be able to debug your code. o/

    An easy way to enable this configuration is to use the @user1793301 method and right click on the file you want to run and select "Debug 'go run .go'".


    POSSIBLE EXPLANATION

    NOTICE: I did not look any further details about it.

    Fact: "Go Application" configuration does build the binary executable before running it.

    Fact: I could see looking at the console output (inside of the Goglang) is that the IDE uses the DLV as debugging tool.

    Fact: I found a dlv debug at the DLV documentation and it seems to compile and debug the code.

    Hypothesis: The guys from Jetbrains did not implement it. Or at least not YET.

提交回复
热议问题