vscode
vscode copied to clipboard
Debug go in devcontainer doesn't hit the breakpoint
Does this issue occur when all extensions are disabled?: Yes/No
- VS Code Version: 1.94
- OS Version: mac os sequoia 15.0.1
Steps to Reproduce:
- .devcontainer/devcontainer.json:
{
"name": "Pdf Service Dev",
"dockerComposeFile": "./docker-compose.yml",
"service": "profile-pdf-ws",
"shutdownAction": "stopCompose",
"workspaceFolder": "/workspace",
"forwardPorts": [
4204
],
"containerEnv": {
"GOARCH": "amd64",
"CGO_ENABLED": "0",
"GOOS": "linux"
},
"customizations": {
"vscode": {
"forwardSSH": true,
"debuggerType": "chrome",
"settings": {
"terminal.integrated.shell.linux": "/bin/bash",
"go.inferGopath": true,
"go.useLanguageServer": true
},
"extensions": [
"redhat.vscode-yaml",
"GitHub.copilot-chat",
"GitHub.copilot",
"streetsidesoftware.code-spell-checker",
"golang.Go"
]
}
}
}
// .devcontainer/docker-compose.yml
services:
profile-pdf-ws:
container_name: profile-pdf-ws
build:
dockerfile: ./Dockerfile
context: ./
volumes:
- ../:/workspace:cached
security_opt:
- seccomp:unconfined
command: /bin/sh -c "while sleep 1000; do :; done"
env_file:
- ../.env
ports:
- "4204:4204"
networks:
- profile-network
networks:
profile-network:
external: true
///.devcontainer/Dockerfile
FROM golang:1.23.1-alpine3.20
RUN go install -v github.com/go-delve/delve/cmd/[email protected]
RUN go install -v golang.org/x/tools/gopls@latest
RUN go install -v honnef.co/go/tools/cmd/staticcheck@latest
// .vscode/launch.json
{
"configurations": [
{
"name": "Launch Package",
"type": "go",
"request": "launch",
"mode": "debug",
"program": "${workspaceFolder}",
"apiVersion": 2,
"showLog": true,
}
]
}
In devcontainer: Pressing F5 was able to launch the go project, it just doesn't hit the breakpoints, and the breakpoint greyed out
In Host environment: everything works fine