Skip to content

Setup debugger#134

Merged
alcalawil merged 2 commits intodevelopfrom
task/wil/setup-debugger
Mar 9, 2023
Merged

Setup debugger#134
alcalawil merged 2 commits intodevelopfrom
task/wil/setup-debugger

Conversation

@alcalawil
Copy link
Copy Markdown
Contributor

@alcalawil alcalawil commented Mar 8, 2023

To test:

  1. checkout task/wil/setup-debugger in infra repo
  2. Create a .vscode/launch.json file. You can use the below example (replace <ABSOLUTE_PATH> with your real absolute path to the project folder
{
    // Use IntelliSense to learn about possible attributes.
    // Hover to view descriptions of existing attributes.
    // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
    "version": "0.2.0",
    "configurations": [
        {
            "name": "Delve into Docker",
            "type": "go",
            "request": "attach",
            "mode": "remote",
            "substitutePath": [
                {
                    "from": "<ABSOLUTE_PATH>/string-api",
                    "to": "/string_api",
                },
            ],
            "port": 2346,
            "host": "127.0.0.1",
            "showLog": true,
            "apiVersion": 2,
            "trace": "verbose"
        }
    ]
}
  1. in the infra repo run docker compose up --build
  2. docker ps to make sure containers are healthy. In the ports section you should see that new ports (2345 and 2346) are exposed. These ports are used by vscode to send/receive events to/from the Delve debugger.

image

  1. In vscode go the debugger tab
    image

  2. click on Delve into Docker, now you should see the debug buttons (pause, restart, step over, step in, stop), the debug console in debug bar, and you can set breakpoints.

image

  1. Put some breakpoints in the code, go to Postman and send a request. If the code is reachable it should stop on the breakpoint.

if you can go deeper on how to use the vscode debugger you can visit this link

ocasta181
ocasta181 previously approved these changes Mar 9, 2023
Copy link
Copy Markdown
Contributor

@auroter auroter left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeet

@alcalawil alcalawil merged commit 01eb41a into develop Mar 9, 2023
@alcalawil alcalawil deleted the task/wil/setup-debugger branch March 9, 2023 18:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants