go-delve / delve

Delve is a debugger for the Go programming language.
MIT License
23.09k stars 2.15k forks source link

add note about DOCKER_DEFAULT_PLATFORM while debugging on mac #3708

Open indera opened 7 months ago

indera commented 7 months ago

This is more a PSA ticket - if we consider it useful let's add it to the docs.

If you are debugging on macOS (m1-2) and you set this env variable

export DOCKER_DEFAULT_PLATFORM=linux/amd64

then the remote debugger will connect to the code running in a container but will not let the program start

full_bin = "dlv exec --listen=:40000 --headless=true --log=true --accept-multiclient --api-version=2 --continue /tmp/main"

Related SO article: https://stackoverflow.com/questions/65612411/forcing-docker-to-use-linux-amd64-platform-by-default-on-macos

aarzilli commented 7 months ago

As far as I know this doesn't let you debug either. Unless docker (or rather whatever emulator they use) fixed something debugging a program running under emulation will not work. And, to be honest, even if it did I'd be reluctant to recommend that people do something we aren't testing.