-
What is a good default linter set to install with a good default .golangci.yml to use with it? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
I don't think there's any one size fits all here. If anything I would say an empty config is the best place to start. But I see a few approaches you can take. Just the bare minimumThis is what I mean with default. You can create an empty ---
run:
tests: true
output:
format: colored-line-number
print-issued-lines: false
issues:
max-issues-per-linter: 0
max-same-issues: 0 Try it allYou can take a different approach and just enable everything and see where it fails. It might be a good idea for new projects but will probably very hard to implement for existing bigger codebases. Just enable everything and disable all exclusions. If you get annoyed by the warnings of deprecated linters you can disable them. Something like this: ---
run:
deadline: 1m
linters:
enable-all: true
issues:
exclude-use-default: false Find someone you trustJust find a project that you think has a good coding standard or comes from a user or organization that you trust. F.ex. GitHub's Just take the time to read up on lintersAll linters are fairly well documented and contains a description of what it does, a category to tell if it's stylistic, security, to find bugs etc. Just read the list and look for things you care about. You usually don't have to configure any of them from scratch and can leave that until you find potential issues or things you don't like with a linter. If you can't configure it to your likings you can disable it in the future. The rest of the configuration is also documented here and even though there's a lot to read up on just starting at one block and going from there is what you like. If you find your way to If you want to contribute to evolving different approaches to presets or different onboardings feel free to comment in #1141 or #3954 (there's probably more). Just keep in mind that |
Beta Was this translation helpful? Give feedback.
I don't think there's any one size fits all here. If anything I would say an empty config is the best place to start. But I see a few approaches you can take.
Just the bare minimum
This is what I mean with default. You can create an empty
.golanci.yaml
so it's easy to change things when you notice what it does for you, but you don't have to. Maybe you just want to start with some formatting options or you don't want to limit the number of same issues? Then this would be enough:Try it all
You can take a different approach and just enable everyt…