Golangci-lint configuration
Kept uses the Golangci-lint linter to ensure good code quality.
This page describes the configuration required
to make proper use of those linters inside an IDE.
Further information can be found in
the golangci-lint documentation.
Visual Studio Code
In Visual Studio Code the Golang extension is required.
Adding the following lines to the Golang extension
configuration file enables all linters used in this project.
"go.lintTool": {
"type": "string",
"default": "golangci-lint",
"description": "GolangGCI Linter",
"scope": "resource",
"enum": [
"golangci-lint",
]
},
"go.lintFlags": {
"type": "array",
"items": {
"type": "string"
},
"default": ["--fast", "--fix"],
"description": "Flags to pass to GCI Linter",
"scope": "resource"
},
GoLand / IntelliJ requirements
-
Install either the GoLand or IntelliJ Integrated Development Environment (IDE) for the Go programming language, plus the Go Linter plugin.
-
The plugin can be installed via
Settings>>Plugins>>Marketplace, search forGo Linterand install it. Once installed, make sure that the plugin is using the.golangci.ymlfile from the root directory. -
The configuration of
Go Lintercan be found in theToolssection of the settings.
If you are on Windows, you need to install make for the above process to complete.
Note When using the make command on Windows, you may receive an
unrecognized commanderror for a command that is installed. This usually indicates thatPATHfor the binary is not set correctly).