go-flutter-desktop / go-flutter

Flutter on Windows, MacOS and Linux - based on Flutter Embedding, Go and GLFW.
https://hover.build/
BSD 3-Clause "New" or "Revised" License
5.86k stars 282 forks source link

How to debug golang code? #682

Closed ahui2012 closed 1 year ago

ahui2012 commented 1 year ago

Hi Guys, Hover is great tool, I use vscode on windows11 and now I can debug dart code, my vscode debug profile tasks.json

{
    "version": "2.0.0",
    "tasks": [
        {
            "label": "hover build windows",
            "type": "shell",
            "command": "hover build windows --debug",
            "problemMatcher": [
                "$go"
            ]
        }
    ]
}

launch.json

{
    "version": "0.2.0",
    "configurations": [
        {
            "name": "Flutter Desktop App",
            "type": "dart",
            "request": "launch",
            "program": "lib/main_desktop.dart",
            "args": [
                "--use-application-binary",
                "go/build/outputs/windows-debug_unopt/test.exe"
            ],
            "preLaunchTask": "hover build windows"
        }
    ]
}

Is there a way to debug goloang code?

Thanks

pchampio commented 1 year ago

Humm not really, I'm using this when working on the golang embedder: https://github.com/go-flutter-desktop/go-flutter/wiki/Setting-up-hover-to-use-a-home-made-version-of-'go-flutter'. I've never tried to make to make the go code "debug-able" in vscode. Usually, I'm using the terminal and I read the output to know what is going on.