Debugging golang code on docker container with VSCode (delve)
Cloning go-debug repository.
clone https://github.com/ammorteza/go-debug.git
{
"version": "0.2.0",
"configurations": [
{
"name": "Launch",
"type": "go",
"request": "attach",
"mode": "remote",
"remotePath": "/app",
"port": 2345,
"showLog": true,
"trace": "verbose"
}
]
}
Build and run go-debug services with Docker Compose.
docker-compose up
After running docker compose up
, make sure all containers run correctly.
Send request in development mode.
{
"user" : "Morteza Amzajerdi"
}
Send request in debugging mode.
{
"user" : "Morteza Amzajerdi"
}