go-template/.devcontainer/devcontainer.json
2026-03-05 21:52:10 +01:00

65 lines
2.1 KiB
JSON

{
"name": "Go Template",
"image": "golang:1.25-bookworm",
"features": {
// Creates a non-root 'vscode' user with sudo — standard devcontainer UX
"ghcr.io/devcontainers/features/common-utils:2": {
"username": "vscode"
}
},
"remoteUser": "vscode",
// Run once after the container is created.
"postCreateCommand": "make init",
// Fix ownership of the mounted ~/.claude so the vscode user can read host auth.
"postStartCommand": "sudo chown -R vscode:vscode /home/vscode/.claude 2>/dev/null || true",
"customizations": {
"vscode": {
"extensions": [
"golang.go", // official Go extension (gopls)
"EditorConfig.EditorConfig", // respect .editorconfig
"streetsidesoftware.code-spell-checker", // spelling (matches misspell linter)
"mhutchie.git-graph", // lightweight git history graph
"anthropic.claude-code" // Claude Code agent
],
"settings": {
// Disable all Copilot features
"github.copilot.enable": { "*": false },
"github.copilot.editor.enableAutoCompletions": false,
"github.copilot.chat.enabled": false,
"github.copilot.nextEditSuggestions.enabled": false,
"github.copilot.inlineSuggest.enable": false,
"go.useLanguageServer": true,
"go.lintTool": "golangci-lint",
"go.lintFlags": ["--fast"],
"go.lintOnSave": "workspace",
"go.testFlags": ["-race"],
"go.generateOnSave": false,
"[go]": {
"editor.formatOnSave": true,
"editor.codeActionsOnSave": {
"source.organizeImports": "explicit"
}
}
}
}
},
// Reuse host Claude config (auth, settings) — no re-login needed inside container.
"mounts": [
"source=${localEnv:HOME}/.claude,target=/home/vscode/.claude,type=bind,consistency=cached"
],
// Forward the default HTTP port so `make run` is reachable from the host.
"forwardPorts": [8080],
"remoteEnv": {
"CONFIG_PATH": "${containerWorkspaceFolder}/config/dev.yaml"
}
}