The following can be added to your personal settings.json
, but it is recommended to add it to
the <REPOSITORY>/.vscode/settings.json
repo, so the settings will only affect this repository.
// Use gofumpt as formatter.
"gopls": {
"formatting.gofumpt": true,
},
// Use golangci-lint as linter. Make sure you've installed it.
"go.lintTool":"golangci-lint",
"go.lintFlags": ["--fast"],
// You can easily show Go test coverage by running a package test.
"go.coverageOptions": "showUncoveredCodeOnly",
// Executing unit tests with race detection.
// You can add preferences like "-v" or "-count=1"
"go.testFlags": ["-race"],
// Enable language features for files with build tags.
// Attention! This leads to integration/e2e tests being executed when
// running a package test within a package containing integration/e2e
// tests.
"go.buildTags": "integration e2e",
For some inexplicable reason, the "go.lintTool":"golangci-lint",
might be overwritten. In case you don't get all linter suggestions, you might want to check the value of go.lintTool
in the UI settings and make sure it is also set to golangci-lint
.
Additionally, we use the Redhat YAML formatter to have uniform formatting in our .yaml
files.
- Bazel (BazelBuild.vscode-bazel): Bazel syntax highlighting and more
- Go (golang.go): Go language support for VS Code
- HashiCorp Terraform (hashicorp.terraform): Syntax highlighting for Terraform files
- ShellCheck (timonwong.shellcheck): Shell script linter
- vscode-proto3 (zxh404.vscode-proto3): Protobuf language support
- Code Spell Checker (streetsidesoftware.code-spell-checker): Highlights potential spelling mistakes
- Helm Intellisense: (Tim-Koehler.helm-intellisense): Syntax highlighting and more for Helm charts (not available on Open VSX Registry)
- YAML (redhat.vscode-yaml): YAML language support. (Does not work with Helm charts)
- markdownlint (DavidAnson.vscode-markdownlint): Markdown linter
You might also consider to set up Bazel in the IDE (see here).