为了调试Go应用程序,我正在尝试将其安装在我的docker容器中。
在我的Dockerfile中,我指出:
RUN go get github.com/go-delve/delve/cmd/dlv但是当我进入码头集装箱并运行dlv时,它说
bash: dlv: command not found我尝试通过直接在容器中运行go get github.com/go-delve/delve/cmd/dlv来手动安装它。它没有输出就结束了。但我仍然得到相同的“命令未找到”错误。
它看起来一点也不像安装了like。下面是我的环境变量和容器中的Go bin目录:
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我很困惑它为什么不安装..。有什么想法吗?
发布于 2022-09-20 11:05:25
go install github.com/go-delve/delve/cmd/dlv@latest。这里有更多的https://stackoverflow.com/a/24878851/4638604
https://stackoverflow.com/questions/73785388
复制相似问题