Skip to content

How can I debug projects with this structure in VSCODE? #215

Open
@adrianescat

Description

Hey! I have installed delve, and is running fine on my PC. I'm trying to use this config in the launch.json:

{
    "version": "0.2.0",
    "configurations": [
        {
            "name": "Delve",
            "type": "go",
            "request": "launch",
            "mode": "debug",
            "program": "${workspaceRoot}/cmd/web",
            "env": {},
            "args": [],
            "showLog": true
        }
    ],
}

I have the main .go files inside the cmd/web folder. The problem is that I have helpers, dbmodels, error handling inside internal. folder too.

vscode starts the app correctly, but as soon as it requires things from internal or other folders in this structure outside /cmd/web it starts getting errors. It's like the packages imports are not working correctly. If I put everything inside the /cmd/web folder I can debug and put breakpoints in the whole app

How do you debug web API's with this structure?

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions