114 lines
4.9 KiB
JSON
114 lines
4.9 KiB
JSON
// For format details, see https://aka.ms/vscode-remote/devcontainer.json or this file's README at:
|
|
// https://github.com/microsoft/vscode-dev-containers/tree/v0.106.0/containers/docker-existing-docker-compose
|
|
// If you want to run as a non-root user in the container, see .devcontainer/docker-compose.yml.
|
|
{
|
|
"name": "app",
|
|
// Update the 'dockerComposeFile' list if you have more compose files or use different names.
|
|
// The .devcontainer/docker-compose.yml file contains any overrides you need/want to make.
|
|
"dockerComposeFile": [
|
|
"../docker-compose.yml"
|
|
],
|
|
// The 'service' property is the name of the service for the container that VS Code should
|
|
// use. Update this value and .devcontainer/docker-compose.yml to the real service name.
|
|
"service": "service",
|
|
// The optional 'workspaceFolder' property is the path VS Code should open by default when
|
|
// connected. This is typically a file mount in .devcontainer/docker-compose.yml
|
|
"workspaceFolder": "/app",
|
|
// All containers should stop if we close / reload the VSCode window.
|
|
"shutdownAction": "stopCompose",
|
|
"customizations": {
|
|
"vscode": {
|
|
// Set *default* container specific settings.json values on container create.
|
|
"settings": {
|
|
// https://github.com/golang/tools/blob/master/gopls/doc/vscode.md#vscode
|
|
"go.useLanguageServer": true,
|
|
"[go]": {
|
|
"editor.formatOnSave": true,
|
|
"editor.codeActionsOnSave": {
|
|
"source.organizeImports": true
|
|
},
|
|
// Optional: Disable snippets, as they conflict with completion ranking.
|
|
"editor.snippetSuggestions": "none"
|
|
},
|
|
"[go.mod]": {
|
|
"editor.formatOnSave": true,
|
|
"editor.codeActionsOnSave": {
|
|
"source.organizeImports": true
|
|
}
|
|
},
|
|
"[sql]": {
|
|
"editor.formatOnSave": true
|
|
},
|
|
// There are handly utility scripts within /scripts that we invoke via go run.
|
|
// These scripts (and its dependencies) should never be consumed by the actual server directly
|
|
// Thus they are flagged to require the "scripts" build tag.
|
|
// We only inform gopls and the vscode go compiler here, that it has to set this build tag if it sees such a file.
|
|
"go.buildTags": "scripts",
|
|
"gopls": {
|
|
// Add parameter placeholders when completing a function.
|
|
"usePlaceholders": true,
|
|
// If true, enable additional analyses with staticcheck.
|
|
// Warning: This will significantly increase memory usage.
|
|
// DISABLED, done via
|
|
"staticcheck": false
|
|
},
|
|
// https://code.visualstudio.com/docs/languages/go#_intellisense
|
|
"go.autocompleteUnimportedPackages": true,
|
|
// https://github.com/golangci/golangci-lint#editor-integration
|
|
"go.lintTool": "golangci-lint",
|
|
"go.lintFlags": [
|
|
"--fast",
|
|
"--timeout",
|
|
"5m"
|
|
],
|
|
// disable test caching, race and show coverage (in sync with makefile)
|
|
"go.testFlags": [
|
|
"-cover",
|
|
"-race",
|
|
"-count=1",
|
|
"-v"
|
|
],
|
|
"go.coverMode": "atomic", // atomic is required when utilizing -race
|
|
"go.delveConfig": {
|
|
"dlvLoadConfig": {
|
|
// increase max length of strings displayed in debugger
|
|
"maxStringLen": 2048
|
|
},
|
|
"apiVersion": 2
|
|
},
|
|
// ensure that the pgFormatter VSCode extension uses the pgFormatter that comes preinstalled in the Dockerfile
|
|
"pgFormatter.pgFormatterPath": "/usr/local/bin/pg_format",
|
|
// only validate the merged swagger file as the individual files do not meet all linting requirements
|
|
"spectral.validateFiles": [
|
|
"**/api/swagger.yml"
|
|
]
|
|
},
|
|
// Add the IDs of extensions you want installed when the container is created.
|
|
"extensions": [
|
|
// required:
|
|
"golang.go",
|
|
"bradymholt.pgformatter",
|
|
// optional:
|
|
"42crunch.vscode-openapi",
|
|
"stoplight.spectral",
|
|
"heaths.vscode-guid",
|
|
"bungcip.better-toml",
|
|
"eamodio.gitlens",
|
|
"casualjim.gotemplate",
|
|
"yzhang.markdown-all-in-one"
|
|
]
|
|
}
|
|
},
|
|
// import host-local git config, with all applicable includes, into the container (https://github.com/microsoft/vscode-remote-release/issues/2084#issuecomment-2259986798)
|
|
"initializeCommand": "git config -l --global --include > \"${localWorkspaceFolder}\"/.gitconfig.global",
|
|
"postAttachCommand": "while IFS='=' read -r key value; do git config --global \"$key\" \"$value\"; done < \"${containerWorkspaceFolder}\"/.gitconfig.global; rm -f \"${containerWorkspaceFolder}\"/.gitconfig.global",
|
|
// Uncomment the next line if you want start specific services in your Docker Compose config.
|
|
// "runServices": [],
|
|
// Uncomment the next line if you want to keep your containers running after VS Code shuts down.
|
|
// "shutdownAction": "none",
|
|
// Uncomment the next line to run commands after the container is created - for example installing git.
|
|
"postCreateCommand": "go version"
|
|
// "postCreateCommand": "apt-get update && apt-get install -y git",
|
|
// Uncomment to connect as a non-root user. See https://aka.ms/vscode-remote/containers/non-root.
|
|
// "remoteUser": ""
|
|
} |