-
install dlv debugger inside build image
RUN go get github.com/go-delve/delve/cmd/dlv
-
copy dlv to final docker image
COPY --from=build-env /go/bin/dlv /app/dlv
-
build go binary with these flags
go build -gcflags "all=-N -l" -o knative main/main.go
-
exec inside container and attach dlv with the process
./dlv --headless=true --listen=:2345 --api-version=2 --log attach <pid>
-
port forward debugger port on local machine
kubectl port-forward <pod-name> 2345:2345
-
configure IDE for remote debugger
You can do so by going to Run | Edit Configurations… | + | Go Remote and configuring the host and port your remote debugger is listening on.
Last active
August 31, 2019 13:29
-
-
Save junaidk/993933461460716fd41531ebd4cc5e67 to your computer and use it in GitHub Desktop.
go application remote debug
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment