# About using goland debugger

**URL:** <https://forum.heroiclabs.com/t/about-using-goland-debugger/4909>\
**Category:** Documentation\
**Tags:** golang, getting-started\
**Created:** [January 24, 2024, 11:41am UTC](https://forum.heroiclabs.com/t/about-using-goland-debugger/4909 "2024-01-24T11:41:45Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![BOFA1ex](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.heroiclabs.com/bofa1ex/32/2015_2.png) [@BOFA1ex](https://forum.heroiclabs.com/u/BOFA1ex)\
**Post date:** [January 24, 2024, 11:41am UTC](https://forum.heroiclabs.com/t/about-using-goland-debugger/4909/1 "2024-01-24T11:41:45Z")

</div>

> **[Using VSCode Debugger](https://heroiclabs.com/docs/nakama/guides/server-framework/debugging-with-delve/vscode-debugger/)**
>
> Companion guide to Debugging with Delve showing how you can debug your custom Go server runtime code using Delve inside a Docker container via Visual Studio Code.

With some minor modifications to the directions in [Debugging with Delve](https://heroiclabs.com/docs/nakama/guides/server-framework/debugging-with-delve/) guide, and then debug your custom Go server runtime code using Delve inside a Docker container via Goland.

Diff than [Using VSCode Debugger - Heroic Labs Documentation](https://heroiclabs.com/docs/nakama/guides/server-framework/debugging-with-delve/vscode-debugger/#vscode-launchjson)  
There did not recommand to define extra-properties file.

## Install Goland plugin

It only required install the `dlvx` plugin on jetbrain plugin marketplace.

> **[Dlvx - IntelliJ IDEs Plugin | Marketplace](https://plugins.jetbrains.com/plugin/23495-dlvx)**
>
> Provides support for Dlvx Tool. The support includes: Go Remote plus over dlv protocol Support for go-plugin debugging For more information visit the dlvx.

## Debugging and Setting Breakpoints

With the above changes in place, go to the **Edit Configurations…** view in Goland by clicking the button shown below.  
 ![image](https://us1.discourse-cdn.com/flex020/uploads/heroiclabs/original/2X/c/cea70c1b179c3eda7a5715ad03a67d5a1cf5d596.png)

And Click **+** toggle the treelist of configuration type, it shows `Dlvx Go Remote` to choose after `dlvx` plugin install successful.

> Warnning `Dlvx Go Remote` was different from the official `Go Remote` in internal implementation

 ![image](https://us1.discourse-cdn.com/flex020/uploads/heroiclabs/original/2X/c/cf3854b782d0ff01efd8209e918d27b9942b8dca.png)

Typing the local-nakama-server dlv listening port `4000`

 ![image](https://us1.discourse-cdn.com/flex020/uploads/heroiclabs/original/2X/a/a119ef7e1887f78fc7c6dcea7f4d3ba7e56216ad.png)

Now launch the debugger by clicking the play button at the top of the **Run and Debug** panel.

![image](https://us1.discourse-cdn.com/flex020/uploads/heroiclabs/original/2X/a/a4b8276115d45f6a3d2370ba14540e350f5b4b3a.png)

### Breaking on an RPC

Now let’s say we want to debug a call to an RPC. In the following example, we have registered an RPC inside the `InitModule` function. The function name of the RPC is `SomeRpc` .

Set `GoFunction breakpoint` on `SomeRpc`

 ![image](https://us1.discourse-cdn.com/flex020/uploads/heroiclabs/original/2X/8/8c4144be24f0d6825df28b1cf4649b5b21c7bca4.png)

 ![image](https://us1.discourse-cdn.com/flex020/uploads/heroiclabs/original/2X/8/864fe74aff626f257cae377612720ac4f70acc32.png)

We now need to trigger the RPC. We can do this either by calling it from a client or by visiting the Nakama Console in a browser and using the API explorer. Once the RPC has been triggered, you should see that Goland successfully hits the breakpoint and you can now use the standard debugging tools (e.g. Variables, Locals, Step Into, Step Over etc) as you would expect.

 ![image](https://us1.discourse-cdn.com/flex020/uploads/heroiclabs/original/2X/f/f55aabfb1a85560f27a2623df34ae3eebe99800c.png)

 ![image](https://us1.discourse-cdn.com/flex020/uploads/heroiclabs/original/2X/0/0ba719835e7e5ba0c5d90eba2db092f9ca016b9d.png)

---

<div class="post-metadata">

**Author:** ![BOFA1ex](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.heroiclabs.com/bofa1ex/32/2015_2.png) [@BOFA1ex](https://forum.heroiclabs.com/u/BOFA1ex)\
**Post date:** [January 24, 2024, 12:00pm UTC](https://forum.heroiclabs.com/t/about-using-goland-debugger/4909/2 "2024-01-24T12:00:24Z")

</div>

Guiding developers to resolve the `goland debug` related problems.

> [@why nakama can not debug in goland](https://forum.heroiclabs.com/t/why-nakama-can-not-debug-in-goland/4406/8):
>
> I have released a goland plugin in the jetbrain plugin repo. It fixes the flaw of the current jetbrain#IDE dlv remote debugging features. You can find the video on YouTube [[Jetbrain dlvx插件演示] ](https://www.youtube.com/watch?v=mOK-5DCDVNY) Welcome to use it slight_smile Accept any different thoughts.

---

<div class="post-metadata">

**Author:** ![baledreamcastau](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.heroiclabs.com/baledreamcastau/32/2129_2.png) [@baledreamcastau](https://forum.heroiclabs.com/u/baledreamcastau)\
**Post date:** [April 2, 2024, 4:23pm UTC](https://forum.heroiclabs.com/t/about-using-goland-debugger/4909/3 "2024-04-02T16:23:31Z")

</div>

Hi BOFA1ex,

Thanks for the plugins!

I managed to breakpoint using Goland based on your plugin and documentation.

I triggered the RpcTest call from the admin local website, however my breakpoint is a bit weird, when the program hit a breakpoint, the Goland breakpoint line doesnt turn to blue like it always does. and the code line from the breakpoint data does not match my actual code file’s line (function call is at line 16 but the breakpoint data shows it is main.go:17)

 ![image](https://us1.discourse-cdn.com/flex020/uploads/heroiclabs/original/2X/a/af63a03de1e8bae1898b809017da6f7e231c3b07.png)  
here is my docker compose’s entrypoint config

```auto
    entrypoint:
      - "/bin/sh"
      - "-ecx"
      - >
        /nakama/nakama migrate up --database.address postgres:localdb@postgres:5432/nakama &&
        /nakama/dlv --log --log-output=debugger --listen=:4000 --headless=true --accept-multiclient --api-version=2 exec nakama -- --config /nakama/data/local.yml --database.address postgres:localdb@postgres:5432/nakama

```

here is my docker file

```auto
FROM heroiclabs/nakama-pluginbuilder:3.21.1 AS go-builder

ENV GO111MODULE on
ENV CGO_ENABLED 1

WORKDIR /backend

RUN apt-get update && \
    apt-get -y upgrade && \
    apt-get install -y --no-install-recommends gcc libc6-dev

RUN go install github.com/go-delve/delve/cmd/dlv@latest

COPY go.mod .
COPY src/*.go .
COPY vendor/ vendor/

RUN go build --trimpath --gcflags "all=-N -l" --mod=vendor --buildmode=plugin -o ./backend.so

FROM registry.heroiclabs.com/heroiclabs/nakama-dsym:3.21.1

COPY --from=go-builder /go/bin/dlv /nakama
COPY --from=go-builder /backend/backend.so /nakama/data/modules/
COPY local.yml /nakama/data/

```

can you tell what i did wrongly ? thank you for your time i would really appreciate if you could help me take a look

---

<div class="post-metadata">

**Author:** ![BOFA1ex](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.heroiclabs.com/bofa1ex/32/2015_2.png) [@BOFA1ex](https://forum.heroiclabs.com/u/BOFA1ex)\
**Post date:** [April 3, 2024, 6:00am UTC](https://forum.heroiclabs.com/t/about-using-goland-debugger/4909/5 "2024-04-03T06:00:11Z")

</div>

Please report issues over [GitHub - BOFA1ex/dlvx](https://github.com/BOFA1ex/dlvx), thanks.
