Skip to content

Instantly share code, notes, and snippets.

@sashaaro
Created October 22, 2021 10:56
Show Gist options
  • Save sashaaro/31d2aa38a1afad992339e24d30828e05 to your computer and use it in GitHub Desktop.
Save sashaaro/31d2aa38a1afad992339e24d30828e05 to your computer and use it in GitHub Desktop.
Golang docker service with debbuger delve and source

How to enable debug go services from my source

If you want change, debug and rebuild go services need build docker-compose/php/go-delve.Dockerfile image and uncomment override go services in config docker-compose/php/docker-compose.yml reload service

./dd.sh upc goapi

Goland -> Run/Debug Configuration -> add new Go Remote -> host=localhost, port=9004 Press the green bug for rebuild and debug services.

goapi:
image: delve:local
entrypoint: dlv
working_dir: /opt/app
labels:
- "SERVICE_NAME=goapi"
ports:
- 9004:9004
command:
- "debug"
- "--headless"
- "--listen=:9004"
- "--api-version=2"
- "--accept-multiclient"
- "--log"
- "cmd"
volumes:
# - ../api:/opt/app
# docker build -t delve:local -f go-delve.Dockerfile .
FROM golang:1.17
RUN go install github.com/go-delve/delve/cmd/dlv@latest
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment