I'm trying to get delve installed in my docker container for debugging Go applications.
In my Dockerfile I put:
RUN go get github.com/go-delve/delve/cmd/dlv
But when I enter the docker container and run dlv
it says
bash: dlv: command not found
I tried manually installing it by running go get github.com/go-delve/delve/cmd/dlv
directly in the container. It finishes with no output. But I still get the same "command not found" error
It doesn't look like it installed delve at all. Here are my environment variables and Go bin directories inside the container:
root@5d8aef1f6721:/my/project# printenv | grep GO
GOFLAGS=-mod=vendor
GOLANG_VERSION=1.19.1
GOROOT=/usr/local/go
GOPATH=/go
root@5d8aef1f6721:/my/project# printenv | grep PATH
PATH=/go/bin:/usr/local/go/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
GOPATH=/go
root@5d8aef1f6721:/my/project# ls -la /go/bin
total 23540
drwxrwxrwx 1 root root 4096 Sep 20 10:29 .
drwxrwxrwx 1 root root 4096 Sep 20 10:28 ..
-rwxr-xr-x 1 root root 24085739 Sep 20 10:29 saml
root@5d8aef1f6721:/my/project# ls -la /usr/local/go/bin
total 17456
drwxr-xr-x 2 root root 4096 Aug 31 17:40 .
drwxr-xr-x 10 root root 4096 Aug 31 17:40 ..
-rwxr-xr-x 1 root root 14520630 Aug 31 17:40 go
-rwxr-xr-x 1 root root 3340906 Aug 31 17:40 gofmt
I'm stumped as to why it's not installing... Any idea?
CodePudding user response:
go install github.com/go-delve/delve/cmd/dlv@latest
. More here https://stackoverflow.com/a/24878851/4638604