Wails: debugging with breakpoints in go code

Created on 19 Sep 2019  路  4Comments  路  Source: wailsapp/wails

First of all I'd like to say, great job guys!

My question is, is it possible to use breakpoints either in VS code or GoLand?
I have all-ready made a few tools with wails, but for the life of me I can't figure out the breakpoints in go code.

Thanks!

question

Most helpful comment

Hi @leaanthony - Thanks for the tip. I got it working with vscode.

I needed a launch.json and a task.json file as well.

I don't know the inner workings of wails enough but I think if you put a .vscode folder that contains these two files in the template folders it could work out of the box. GoLand proves to be more difficult, but I think GoLand users are a minority.

launch.json:

{
  "version": "0.2.0",
  "configurations": [
    {
      "name": "Wails: build debug",
      "type": "go",
      "request": "launch",
      "mode": "exec",
      "program": "${workspaceFolder}/myapp",
      "preLaunchTask": "wails_debug_build",
      "env": {},
      "args": []
    }
  ]
}

task.json:

{
  "version": "2.0.0",
  "tasks": [
    {
      "label": "wails_debug_build",
      "type": "shell",
      "command": "wails build -d"
    }
  ]
}

All 4 comments

Hi @Lyimmi - Thanks for the encouragement! It is possible to debug in vscode as I've done so before but I had a quick go and couldn't get the breakpoints triggered. It was a while back but I'm certain it was using the "exec" debug type and pointing to the binary.

I'm thinking that maybe we should auto generate a tasks.json with the correct build parameters. This would probably be a better option. Not sure what we could do for goland.

Thoughts?

I didn't had time to try other methods, but I'll check what you suggested via exec and tasks.json for vscode, and have a go at it in goland as well.

I'm trying to solve arm64 cross compilation at the moment (building on my linux machine than on the raspberry pi is driving me insane), but if I figure out the debugging I'll post it here.

Hi @leaanthony - Thanks for the tip. I got it working with vscode.

I needed a launch.json and a task.json file as well.

I don't know the inner workings of wails enough but I think if you put a .vscode folder that contains these two files in the template folders it could work out of the box. GoLand proves to be more difficult, but I think GoLand users are a minority.

launch.json:

{
  "version": "0.2.0",
  "configurations": [
    {
      "name": "Wails: build debug",
      "type": "go",
      "request": "launch",
      "mode": "exec",
      "program": "${workspaceFolder}/myapp",
      "preLaunchTask": "wails_debug_build",
      "env": {},
      "args": []
    }
  ]
}

task.json:

{
  "version": "2.0.0",
  "tasks": [
    {
      "label": "wails_debug_build",
      "type": "shell",
      "command": "wails build -d"
    }
  ]
}

Thanks for the update! I want to add this as part of default template generation. :+1:

Was this page helpful?
0 / 5 - 0 ratings

Related issues

bh90210 picture bh90210  路  3Comments

yosefbenshimon picture yosefbenshimon  路  5Comments

conanchen picture conanchen  路  5Comments

intelwalk picture intelwalk  路  4Comments

leaanthony picture leaanthony  路  3Comments