go-delve / delve

Delve is a debugger for the Go programming language.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

add note about DOCKER_DEFAULT_PLATFORM while debugging on mac

indera opened this issue · comments

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

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.