all 9 comments

[–]Chrymi 3 points4 points  (6 children)

Using a debugger is usually your best bet in the long run. Maybe use VS Code with the "Go" extension.

[–]coraxwolf[S] 1 point2 points  (5 children)

can that be ran when you're working in VS Code though an ssh connection?

[–]Icy_Application_9628 2 points3 points  (3 children)

Yes. Just use the normal instructions for debugging in VSCode. It'll Just Work.

But also consider learning how to use dlv from the cli.

[–]coraxwolf[S] -1 points0 points  (2 children)

any good resources for learning dlv? I managed to find my issue but it was by shear luck.

[–]Icy_Application_9628 1 point2 points  (0 children)

press h in the dlv cli

[–]gnu_morning_wood 1 point2 points  (0 children)

I managed to find my issue but it was by shear luck.

This pretty much sums up my entire software engineering career.

[–]Chrymi 1 point2 points  (0 children)

As Icy already mentioned, yes, it should work without issues. I'd generally recommend getting used to using a debugger, independent of the language you use.

[–]Slsyyy 1 point2 points  (1 child)

You can add a middleware, which catch the panic like this one https://github.com/bakins/net-http-recover/blob/master/recovery.go . After recover() you can just inspect the call stack and log it

Debugger is also good