

To Build container, run the following standard command: docker build -t go-debug:1.12 -f Dockerfile-1.12. The /.cache dir is created only for dep’s working, you can remove the instruction to create & chmod this folder if you don’t need dep. You don’t need to use it if you use other package managers, for example, vgo. Here we try to avoid some known restrictions of Delve, for example, max-string-len: 4096 changes the maximum string length, used for evaluating string variables, to 4096 bytes by default this limit is 64 bytes which is too short.Īlso, here we install dep for some projects using dep. The ~/.config/dlv/config.yml is a Delve’s configuration file. This allows you to easily switch between different Golang versions at the same machine. You can replace 1.12 to 1.13 in your Dockerfile name and content to use Go 1.13, for example. & echo " - /usr/lib/debug/.build-id" > ~/.config/dlv/config.yml & echo "debug-info-directories:" > ~/.config/dlv/config.yml \ & echo "source-list-line-color: 34" > ~/.config/dlv/config.yml \

& echo "show-location-expr: false" > ~/.config/dlv/config.yml \ & echo "max-variable-recurse: 128" > ~/.config/dlv/config.yml \

& echo "max-array-values: 512" > ~/.config/dlv/config.yml \ & echo "max-string-len: 2048" > ~/.config/dlv/config.yml \ & echo "substitute-path: " > ~/.config/dlv/config.yml \ & echo "aliases: " > ~/.config/dlv/config.yml \
#Goland debug apk
& apk add -no-cache dep bash mc git build-base libc6-compat vim \ So, we can build a new container, for example, as described: Dockerfile-1.12 FROM golang:1.12-alpine Is is also suitable for running in Docker containers. The best known remote debugger for Golang apps is Delve.
