Skip to content

Instantly share code, notes, and snippets.

@cijohnson
Last active March 11, 2021 19:06
Show Gist options
  • Save cijohnson/8db8742ec941fdbef651b588c243e438 to your computer and use it in GitHub Desktop.
Save cijohnson/8db8742ec941fdbef651b588c243e438 to your computer and use it in GitHub Desktop.
Debugging go binary
Below steps are followed to install go/dlv and debug the running golang process in container.
export GOVERSION=1.14
yum install -y git wget
cd /; wget https://golang.org/dl/go$GOVERSION.linux-amd64.tar.gz
cd /; tar -C /usr/local -xzf go$GOVERSION.linux-amd64.tar.gz
cd /; export PATH=$PATH:/usr/local/go/bin
cd /; go get -u github.com/go-delve/delve/cmd/dlv
cd /; export PATH=$PATH:$PWD/go/bin:/root/go/bin
export GOPATH=/go
dlv attach <pid of the commandappserver process>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment