mirror of
https://github.com/1f349/dendrite.git
synced 2024-11-26 05:31:32 +00:00
replaced gometalinter description with golangci-lint (#837)
This commit is contained in:
parent
dc25fb6837
commit
5741235833
@ -1,21 +1,23 @@
|
|||||||
# Code Style
|
# Code Style
|
||||||
|
|
||||||
We follow the standard Go style using gofmt, but with a few extra
|
We follow the standard Go style using goimports, but with a few extra
|
||||||
considerations.
|
considerations.
|
||||||
|
|
||||||
## Linters
|
## Linters
|
||||||
|
|
||||||
We use `gometalinter` to run a number of linters, the exact list can be found
|
We use `golangci-lint` to run a number of linters, the exact list can be found
|
||||||
in [linter.json](linter.json). Some of these are slow and expensive to run, but
|
under linters in [.golangci.yml](.golangci.yml).
|
||||||
a subset can be found in [linter-fast.json](linter-fast.json) that run quickly
|
[Installation](https://github.com/golangci/golangci-lint#install) and [Editor
|
||||||
enough to be run as part of an IDE.
|
Integration](https://github.com/golangci/golangci-lint#editor-integration) for
|
||||||
|
it can be found in the readme of golangci-lint.
|
||||||
|
|
||||||
For rare cases where a linter is giving a spurious warning, it can be disabled
|
For rare cases where a linter is giving a spurious warning, it can be disabled
|
||||||
for that line or statement using a [comment directive](https://github.com/alecthomas/gometalinter#comment-directives), e.g.
|
for that line or statement using a [comment
|
||||||
`// nolint: gocyclo`. This should be used sparingly and only when its clear
|
directive](https://github.com/golangci/golangci-lint#nolint), e.g. `var
|
||||||
that the lint warning is spurious.
|
bad_name int //nolint:golint,unused`. This should be used sparingly and only
|
||||||
|
when its clear that the lint warning is spurious.
|
||||||
|
|
||||||
The linters are vendored, and can be run using [scripts/find-lint.sh](scripts/find-lint.sh)
|
The linters can be run using [scripts/find-lint.sh](scripts/find-lint.sh)
|
||||||
(see file for docs) or as part of a build/test/lint cycle using
|
(see file for docs) or as part of a build/test/lint cycle using
|
||||||
[scripts/build-test-lint.sh](scripts/build-test-lint.sh).
|
[scripts/build-test-lint.sh](scripts/build-test-lint.sh).
|
||||||
|
|
||||||
@ -82,9 +84,9 @@ sets up linting correctly:
|
|||||||
|
|
||||||
```json
|
```json
|
||||||
{
|
{
|
||||||
"go.gopath": "${workspaceRoot}:${workspaceRoot}/vendor",
|
"go.lintTool":"golangci-lint",
|
||||||
"go.lintOnSave": "workspace",
|
"go.lintFlags": [
|
||||||
"go.lintTool": "gometalinter",
|
"--fast"
|
||||||
"go.lintFlags": ["--config=linter-fast.json", "--concurrency=5"]
|
]
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
Loading…
Reference in New Issue
Block a user