See .golangci.yml
It's 01-defaults plus :
License: MIT
golangci-lint configuration file made by @ccoVeille Source: https://github.com/ccoVeille/golangci-lint-config-examples/tree/main/02-basics
Errcheck is a program for checking for unchecked errors in Go code.
Linter for Go source code that specializes in simplifying code.
Vet examines Go source code and reports suspicious constructs.
Detects when assignments to existing variables are not used.
It's a set of rules from staticcheck. See https://staticcheck.io/
Fast, configurable, extensible, flexible, and beautiful linter for Go. Drop-in replacement of golint.
Blank import should be only in a main or test package, or have a comment justifying it.
context.Context()
should be the first parameter of a function when provided as argument.
Basic types should not be used as a key in context.WithValue
Importing with .
makes the programs much harder to understand
Empty blocks make code less readable and could be a symptom of a bug or unfinished refactoring.
for better readability, variables of type error
must be named with the prefix err
.
for better readability, the errors should be last in the list of returned values by a function.
for better readability, error messages should not be capitalized or end with punctuation or a newline.
report when replacing errors.New(fmt.Sprintf())
with fmt.Errorf()
is possible
incrementing an integer variable by 1 is recommended to be done using the ++
operator
highlights redundant else-blocks that can be eliminated from the code
This rule suggests a shorter way of writing ranges that do not use the second value.
receiver names in a method should reflect the struct name (p for Person, for example)
redefining built-in names (true, false, append, make) can lead to bugs very difficult to detect.
redundant else-blocks that can be eliminated from the code.
prevent confusing name for variables when using time
package
warns when an exported function or method returns a value of an un-exported type.
spots and proposes to remove unreachable code. also helps to spot errors
Functions or methods with unused parameters can be a symptom of an unfinished refactoring or a bug.
report when a variable declaration can be simplified
warns when initialism, variable or package naming conventions are not followed.