You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I was wondering how to debug the go code in development?
Normaly i would use delve to set breakpoints in VSCode , but i'm not quite sure how to do this in a docker-compose setup.
Any insights would be appreciated.
The text was updated successfully, but these errors were encountered:
Here is how i solved it right now. I appreciate any input, how others solve this!
The delve debugger compiles and executes the application, exposes the http server under port 8080 and the debug server under 12345. These ports are mapped in the docker-compose.yaml file (in my case) to 30001 and 30002. The launch.json configuration attaches the debugger instance to the running container.
On code change reflex restarts the debugger.
Dockerfile
FROM golang:1.18-alpine AS base
WORKDIR /app
FROM base AS development
RUN apk add build-base
# Create external debuggerRUN go install github.com/go-delve/delve/cmd/dlv@latest
# Restart server on code changeRUN go install github.com/cespare/reflex@latest
COPY reflex.conf /
ENTRYPOINT ["reflex", "-c", "/reflex.conf"]
I was wondering how to debug the go code in development?
Normaly i would use
delve
to set breakpoints in VSCode , but i'm not quite sure how to do this in adocker-compose
setup.Any insights would be appreciated.
The text was updated successfully, but these errors were encountered: