Skip to content

Debugging golang code on docker container with VSCode (Delve)

Notifications You must be signed in to change notification settings

ammorteza/go-debug

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

go-debug

Debugging golang code on docker container with VSCode (delve)

Requirements

Instalation

Clone

Cloning go-debug repository.

clone https://github.com/ammorteza/go-debug.git

Configure debugging with VSCode

{
    "version": "0.2.0",
    "configurations": [
        {
            "name": "Launch",
            "type": "go",
            "request": "attach",
            "mode": "remote",
            "remotePath": "/app",
            "port": 2345,
            "showLog": true,
            "trace": "verbose"
          }
    ]
}

Build

Build and run go-debug services with Docker Compose.

docker-compose up

After running docker compose up, make sure all containers run correctly.

Running

API Endpoint

Send request in development mode.

http://localhost:8090/rest/user

{
	"user" : "Morteza Amzajerdi"
}

Send request in debugging mode.

http://localhost:9999/rest/user

{
	"user" : "Morteza Amzajerdi"
}

About

Debugging golang code on docker container with VSCode (Delve)

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages