| A | B | C | D | E | F | G | H | I | J | K | L | M | N | O | P | Q | R | S | T | U | V | W | X | Y | |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
1 | Linter | Description | Status | Comments | Settings | ||||||||||||||||||||
2 | errcheck ⚙️ | errcheck is a program for checking for unchecked errors in Go code. These unchecked errors can be critical bugs in some cases | Enabled | # Report about not checking of errors in type assertions: `a := b.(MyStruct)`. # Such cases aren't reported by default. # Default: false check-type-assertions = true | |||||||||||||||||||||
3 | gosimple ⚙️ | Linter for Go source code that specializes in simplifying code | Enabled | ||||||||||||||||||||||
4 | govet ⚙️ | Vet examines Go source code and reports suspicious constructs, such as Printf calls whose arguments do not align with the format string | Enabled | # Enable all analyzers. # Default: false enable-all = true # Disable analyzers by name # See https://pkg.go.dev/golang.org/x/tools/go/analysis/passes#section-directories disable = [ # (not needed) reports mismatches between assembly files and Go # declarations. "asmdecl", # (dupl staticcheck) detects useless assignments. "assign", # (not needed) detects some violations of the cgo pointer passing rules. "cgocall", # (not needed) detects structs that would use less memory if their fields # were sorted. "fieldalignment", # (not needed) serves as a trivial example and test of the Analysis API. "findcall", # (not needed) reports assembly code that clobbers the frame pointer # before saving it. "framepointer", # (dupl revive struct-tag) defines an Analyzer that checks struct field # tags are well formed. "structtag", ] | |||||||||||||||||||||
5 | ineffassign | Detects when assignments to existing variables are not used | Enabled | ||||||||||||||||||||||
6 | staticcheck ⚙️ | It's a set of rules from staticcheck. It's not the same thing as the staticcheck binary. The author of staticcheck doesn't support or approve the use of staticcheck as a library inside golangci-lint. | Enabled | ||||||||||||||||||||||
7 | unused | Checks Go code for unused constants, variables, functions and types | Enabled | ||||||||||||||||||||||
8 | asasalint ⚙️ | check for pass []any as any in variadic func(...any) | Disabled | Value proposition is not positive. The check is highly unlikely to be applicable and useful. | |||||||||||||||||||||
9 | asciicheck | Simple linter to check that your code does not contain non-ASCII identifiers | Disabled | Value proposition is not positive. The check is highly unlikely to be applicable and useful. | |||||||||||||||||||||
10 | bidichk ⚙️ | Checks for dangerous unicode character sequences | Disabled | Addressed in GitLab via https://about.gitlab.com/releases/2021/10/28/security-release-gitlab-14-4-1-released/ and on GitHub via https://github.blog/changelog/2021-10-31-warning-about-bidirectional-unicode-text/. | |||||||||||||||||||||
11 | bodyclose | checks whether HTTP response body is closed successfully | Enabled | Although the body would need to be drained for connection reuse to be possible, it is still a useful improvement to have a check for closing the response body. However, due to bodyclose#51, there might be false positives making it difficult to use the linter. | |||||||||||||||||||||
12 | canonicalheader | Canonicalheader checks whether net/http.Header uses canonical header. | Disabled | http.Header has explicit handling for canonisation of headers for storage and retrieval making this linter's value proposition relatively small. | |||||||||||||||||||||
13 | containedctx | containedctx is a linter that detects struct contained context.Context field | Disabled | Value proposition is not positive. The check is highly unlikely to be applicable and useful. | |||||||||||||||||||||
14 | contextcheck | check whether the function uses a non-inherited context | Disabled | Value proposition is not positive. The check is highly unlikely to be applicable and useful. | |||||||||||||||||||||
15 | copyloopvar ⚙️ | Copyloopvar is a linter detects places where loop variables are copied. | Enabled | We can enable this after upgrading to Go 1.22. See https://go.dev/blog/loopvar-preview. | |||||||||||||||||||||
16 | cyclop ⚙️ | checks function and package cyclomatic complexity | Disabled | Both gocognit and cyclop try and evaluate the complexity of a function but the methodology is different. gocognit evaluates cognitive complexity while cyclop evaluates cyclometic complexity. Based on the examples present in the gocognit which compare the two, gocognit appears to be the better choice. Having both linters enabled would not add much value IMHO. | |||||||||||||||||||||
17 | decorder ⚙️ | check declaration order and count of types, constants, variables and functions | Disabled | Stylistic check that isn't too useful and we sometimes intentionally colocate different declaration types out of order to aid cognition. | |||||||||||||||||||||
18 | depguard ⚙️ | Go linter that checks if package imports are in a list of acceptable packages | Disabled | We do not have a standardised list of whitelisted or blacklisted packages to apply the rule with. | |||||||||||||||||||||
19 | dogsled ⚙️ | Checks assignments with too many blank identifiers (e.g. x, , , _, := f()) | Disabled | Value proposition is not positive. The check is highly unlikely to be applicable and useful. | |||||||||||||||||||||
20 | dupl ⚙️ | Tool for code clone detection | Enabled | ||||||||||||||||||||||
21 | dupword ⚙️ | checks for duplicate words in the source code | Disabled | Value proposition is not positive. The check is highly unlikely to be applicable and useful. | |||||||||||||||||||||
22 | durationcheck | check for two durations multiplied together | Disabled | Unlikely to be relevant for our usecase. | |||||||||||||||||||||
23 | errchkjson ⚙️ | Checks types passed to the json encoding functions. Reports unsupported types and optionally reports occasions, where the check for the returned error can be omitted. | Disabled | Value proposition is not positive. The check is highly unlikely to be applicable and useful. | |||||||||||||||||||||
24 | errname | Checks that sentinel errors are prefixed with the Err and error types are suffixed with the Error. | Enabled | Enforces sensible naming convention for error types and error declarations | |||||||||||||||||||||
25 | errorlint ⚙️ | errorlint is a linter for that can be used to find code that will cause problems with the error wrapping scheme introduced in Go 1.13. | Enabled | ||||||||||||||||||||||
26 | execinquery | execinquery is a linter about query string checker in Query function which reads your Go src files and warning it finds | Disabled | Value proposition is not positive. The check is highly unlikely to be applicable and useful. There also seem to be some false positives. | |||||||||||||||||||||
27 | exhaustive ⚙️ | check exhaustiveness of enum switch statements | Disabled | On checking reported errors with this linter, only saw false positives. We might use switch-case as a better 'if equal to one of x, y, z etc' which would also be flagged by this linter. | |||||||||||||||||||||
28 | exhaustruct ⚙️ | Checks if all structure fields are initialized | Disabled | Not a general purpose linter and is suitable to be enabled with specific types that expect all fields to be populated during usage. | |||||||||||||||||||||
29 | exportloopref | checks for pointers to enclosing loop variables | Disabled | govet already reports an error when loop variable is captured by func literal so this linter is not needed. | |||||||||||||||||||||
30 | fatcontext | Detects nested contexts in loops and function literals. | Disabled | Haven't seen instances in practice where this linter would be useful. | |||||||||||||||||||||
31 | forbidigo ⚙️ | Forbids identifiers | Enabled | Can be helpful to forbid known wrong usages of methods such as log.Info(fmt.Sprintf(...)). edit: doesn't work | # Forbid the following identifiers (list of regexp). # Default: ["^(fmt\\.Print(|f|ln)|print|println)$"] forbidgo = [ { p = "^(fmt\\.Print(|f|ln)|print|println)$", msg = "Do not commit print statements." }, ] | ||||||||||||||||||||
32 | forcetypeassert | finds forced type assertions | Disabled | This check can be enabled through errcheck with check-type-assertions. | |||||||||||||||||||||
33 | funlen ⚙️ | Tool for detection of long functions | Disabled | It is hard to pick the appropriate value for the limit on function length. | |||||||||||||||||||||
34 | gci ⚙️ | Gci controls Go package import order and makes it always deterministic. | Enabled | It makes sense to integrate this into the linter and also update the Makefile to run the formatter in conjuction with gofumpt. Whatever functionality is missing in gci as compared to goimports is covered by gofumpt so there is no downside. | # Section configuration to compare against. # Section names are case-insensitive and may contain parameters in (). # The default order of sections is `standard > default > custom > blank > dot`, # If `custom-order` is `true`, it follows the order of `sections` option. # Default: ["standard", "default"] sections = [ "standard", # Standard section: captures all standard packages. "default", # Default section: contains all imports that could not be matched to another section type. "prefix(github.com/netskope,github.com/netSkope)", # Custom section: groups all imports with the specified Prefix. ] # Enable custom order of sections. # If `true`, make the section order the same as the order of `sections`. # Default: false custom-order = true | ||||||||||||||||||||
35 | ginkgolinter ⚙️ | enforces standards of using ginkgo and gomega | Disabled | We are not planning to use ginkgo or gomega. | |||||||||||||||||||||
36 | gocheckcompilerdirectives | Checks that go compiler directive comments (//go:) are valid. | Enabled | Faulty compiler directives get ignored and can be source of confusion when things don't work as expected. | |||||||||||||||||||||
37 | gochecknoglobals | check that no global variables exist | Disabled | While the principle is agreeable, it is hard to disallow all global variables. | |||||||||||||||||||||
38 | gochecknoinits | Checks that no init functions are present in Go code | Enabled | We can enable the linter and gather feedback on whether it is getting in our way and disable based on it. | |||||||||||||||||||||
39 | gochecksumtype | Run exhaustiveness checks on Go "sum types". | Disabled | Value proposition is not positive. The check is not likely to be applicable and useful. | |||||||||||||||||||||
40 | gocognit ⚙️ | Computes and checks the cognitive complexity of functions | Enabled | Since it is not a fast linter, proposing to enable it only for the PROD config. | # Minimal code complexity to report. # Default: 30 (but we recommend 10-20) min-complexity = 20 | ||||||||||||||||||||
41 | goconst ⚙️ | Finds repeated strings that could be replaced by a constant | Enabled | # Ignore test files. # Default: false ignore-tests = true | |||||||||||||||||||||
42 | gocritic ⚙️ | Provides diagnostics that check for bugs, performance and style issues. Extensible without recompilation through dynamic rules. Dynamic rules are written declaratively with AST patterns, filters, report message and optional suggestion. | Enabled | # Disable all checks. # Default: false disable-all = true # Which checks should be enabled; can't be combined with 'disabled-checks'. # See https://go-critic.github.io/overview#checks-overview. # To check which checks are enabled run `GL_DEBUG=gocritic golangci-lint run`. # By default, list of stable checks is used. enabled-checks = [ # ============ Diagnostic ============ # https://go-critic.com/overview.html#checkers-from-the-diagnostic-group # Detects suspicious arguments order. "argOrder", # Detects suspicious function calls. "badCall", # Detects suspicious condition expressions. "badCond", # Detects suspicious mutex lock/unlock operations. "badLock", # Detects erroneous case order inside switch statements. "caseOrder", # Detects commented-out code inside function bodies. "commentedOutCode", # Detects loops inside functions that use defer. "deferInLoop", # Detects malformed ‘deprecated’ doc-comments. "deprecatedComment", # Detects suspicious duplicated arguments. "dupArg", # Detects duplicated case clauses inside switch or select statements. "dupCase", # Detects calls to exit/fatal inside functions that use defer. "exitAfterDefer", # Detects problems in filepath.Join() function calls. "filepathJoin", # Detects suspicious map literal keys. "mapKey", # Detects various off-by-one kind of errors. "offBy1", # Detects append all its data while range it. "rangeAppendAll", # Detects suspicious http.Error call without following return. "returnAfterHttpError", # Detects suspicious/confusing re-assignments. "sloppyReassign", # Detects redundant type assertions. "sloppyTypeAssert", # Detects “%s” formatting directives that can be replaced with %q. "sprintfQuotedString", # Detects potential truncation issues when comparing ints of different # sizes. "truncateCmp", # Detects conditions that are unsafe due to not being exhaustive. "weakCond", # ============ Style ============ # https://go-critic.com/overview.html#checkers-from-the-style-group # Detects assignments that can be simplified by using assignment # operators. "assignOp", # Detects bool expressions that can be simplified. "boolExprSimplify", # Detects commented-out imports. "commentedOutImport", # Detects else with nested if statement that can be replaced with else-if. "elseif", # Detects fallthrough that can be avoided by using multi case values. "emptyFallthrough", # Detects empty string checks that can be written more idiomatically. "emptyStringTest", # Detects repeated if-else statements and suggests to replace them with # switch statement. "ifElseChain", # Finds where nesting level could be reduced. "nestingReduce", # Detects concatenation with os.PathSeparator which can be replaced with # filepath.Join. "preferFilepathJoin", # Detects input and output parameters that have a type of pointer to # referential type. "ptrToRefParam", # Detects redundant fmt.Sprint calls. "redundantSprint", # Detects regexp patterns that can be simplified. "regexpSimplify", # Detects strings.Compare usage. "stringsCompare", # Detects TODO comments without detail/assignee. "todoCommentWithoutDetail", # Detects dereference expressions that can be omitted. "underef", # Detects unnamed results that may benefit from names. "unnamedResult", # Detects slice expressions that can be simplified to sliced expression # itself. "unslice", # Detects function calls that can be replaced with convenience wrappers. "wrapperFunc", # ============ Performance ============ # https://go-critic.com/overview.html#checkers-from-the-performance-group # Detects fmt.Sprint(f/ln) calls which can be replaced with # fmt.Fprint(f/ln). "preferFprint", # Detects w.Write or io.WriteString calls which can be replaced with # w.WriteString. "preferStringWriter", # Detects loops that copy big objects during each iteration. "rangeValCopy", # Detects redundant conversions between string and []byte. "stringXbytes", ] # Settings passed to gocritic. # The settings key is the name of a supported gocritic checker. # The list of supported checkers can be found in https://go-critic.github.io/overview. [linters-settings.gocritic.settings] [linters-settings.gocritic.settings.underef] # Whether to skip (*x).method() calls where x is a pointer receiver. # Default: true skipRecvDeref = false [linters-settings.gocritic.settings.unnamedResult] # Whether to check exported functions. # Default: false checkExported = true [linters-settings.gocritic.settings.rangeValCopy] # Size in bytes that makes the warning trigger. # Default: 128 sizeThreshold = 512 | |||||||||||||||||||||
43 | gocyclo ⚙️ | Computes and checks the cyclomatic complexity of functions | Disabled | Both gocognit and gocyclo try and evaluate the complexity of a function but the methodology is different. gocognit evaluates cognitive complexity while gocyclo evaluates cyclometic complexity. Based on the examples present in the gocognit which compare the two, gocognit appears to be the better choice. Having both linters enabled would not add much value IMHO. | |||||||||||||||||||||
44 | godot ⚙️ | Check if comments end in a period | Disabled | Value proposition is not positive. The check is highly unlikely to be applicable and useful. | |||||||||||||||||||||
45 | godox ⚙️ | Tool for detection of FIXME, TODO and other comment keywords | Disabled | Although we do miss TODO changes regularly, this tool would block merging changes with any TODO comments. In some cases, we want to tackle the TODO action item in the future. So not proposing to enable the same. | |||||||||||||||||||||
46 | goerr113 | Go linter to check the errors handling expressions | Disabled | Functionality provided is a subset of 'errorlint' linter. | |||||||||||||||||||||
47 | gofmt ⚙️ | Gofmt checks whether code was gofmt-ed. By default this tool runs with -s option to check for code simplification | Disabled | gofumpt includes formatting rules that are a superset of gofmt. | |||||||||||||||||||||
48 | gofumpt ⚙️ | Gofumpt checks whether code was gofumpt-ed. | Enabled | # Choose whether to use the extra rules. # Default: false extra-rules = true | |||||||||||||||||||||
49 | goheader ⚙️ | Checks is file header matches to pattern | Disabled | Not relevant for us as we do not need to have license headers in any of our files. | |||||||||||||||||||||
50 | goimports ⚙️ | Check import statements are formatted according to the 'goimport' command. Reformat imports in autofix mode. | Disabled | goimports adds missing imports and partially formats the import lines in addition to the gofmt functionality for formatting Go source files. In our case, we are only interested in the import lines formatting in the context of linting. This formatting is done in a better and consistent manner by 'gci' so proposing to use that instead. | |||||||||||||||||||||
51 | gomnd ⚙️ | An analyzer to detect magic numbers. | Disabled | Too many false positives. | |||||||||||||||||||||
52 | gomoddirectives ⚙️ | Manage the use of 'replace', 'retract', and 'excludes' directives in go.mod. | Disabled | Value proposition is not positive. The check is highly unlikely to be applicable and useful. | |||||||||||||||||||||
53 | gomodguard ⚙️ | Allow and block list linter for direct Go module dependencies. This is different from depguard where there are different block types for example version constraints and module recommendations. | Disabled | Funcitionality is largely similar to depguard with added functionality. We do not have a standardised list of whitelisted or blacklisted packages to apply the rule with. | |||||||||||||||||||||
54 | goprintffuncname | Checks that printf-like functions are named with f at the end | Disabled | Unlikely to be relevant for our usecase. | |||||||||||||||||||||
55 | gosec ⚙️ | Inspects source code for security problems | Enabled | # To specify a set of rules to explicitly exclude. # Available rules: https://github.com/securego/gosec#available-rules # Default: [] excludes = [ # Look for hard coded credentials # too many false positives "G101" ] | |||||||||||||||||||||
56 | gosmopolitan ⚙️ | Report certain i18n/l10n anti-patterns in your Go codebase | Disabled | Unlikely to be relevant for our usecase. | |||||||||||||||||||||
57 | grouper ⚙️ | An analyzer to analyze expression groups. | Disabled | Value proposition is not positive. Stylistic considerations should be addressed by gofumpt for the most part. | |||||||||||||||||||||
58 | importas ⚙️ | Enforces consistent import aliases | Disabled | Doesn't automatically pick up aliases from the codebase to ensure consistency. | |||||||||||||||||||||
59 | inamedparam ⚙️ | Reports interfaces with unnamed method parameters. | Disabled | Not 100% convinced we need this linter. | |||||||||||||||||||||
60 | interfacebloat ⚙️ | A linter that checks the number of methods inside an interface. | Disabled | Value proposition is not positive. The check is highly unlikely to be applicable and useful. | |||||||||||||||||||||
61 | intrange | Intrange is a linter to find places where for loops could make use of an integer range. | Disabled | We can enable this after upgrading to Go 1.22. See https://go.dev/doc/go1.22#language. | |||||||||||||||||||||
62 | ireturn ⚙️ | Accept Interfaces, Return Concrete Types | Disabled | Too many false positives. | |||||||||||||||||||||
63 | lll ⚙️ | Reports long lines | Enabled | Extremely long lines hurt readability and the proposal is to enable this rule with the line length limit of 160 characters with exclusion for test files. | # Max line length, lines longer will be reported. # '\t' is counted as 1 character by default, and can be changed with the tab-width option. # Default: 120. line-length = 160 | ||||||||||||||||||||
64 | loggercheck ⚙️ | Checks key value pairs for common logger libraries (kitlog,klog,logr,zap). | Disabled | Unlikely to be relevant for our usecase. Doesn't cover slog. | |||||||||||||||||||||
65 | maintidx ⚙️ | maintidx measures the maintainability index of each function. | Disabled | We have gocognit enabled so enabling this linter won't add much value. | |||||||||||||||||||||
66 | makezero ⚙️ | Finds slice declarations with non-zero initial length | Disabled | Enforces use of append with preallocated arrays that might not always be preferred. | |||||||||||||||||||||
67 | mirror | Reports wrong mirror patterns of bytes/strings usage. | Enabled | Only a minor value proposition but in the interest of shifting left and avoiding need for review comments in the rare instance it would be applicable, recommending to enable it. | |||||||||||||||||||||
68 | misspell ⚙️ | Finds commonly misspelled English words in comments | Enabled | Can enforce consistent American English spelling. | # Correct spellings using locale preferences for US or UK. # Default is to use a neutral variety of English. # Setting locale to US will correct the British spelling of 'colour' to 'color'. locale = "US" | ||||||||||||||||||||
69 | musttag ⚙️ | enforce field tags in (un)marshaled structs | Enabled | From the Uber style guide - "The serialized form of the structure is a contract between different systems. Changes to the structure of the serialized form, including field names, break this contract. Specifying field names inside tags makes the contract explicit, and it guards against accidentally breaking the contract by refactoring or renaming fields." | |||||||||||||||||||||
70 | nakedret ⚙️ | Finds naked returns in functions greater than a specified function length | Enabled | We could reduce the function line count further to make it more stringent. | |||||||||||||||||||||
71 | nestif ⚙️ | Reports deeply nested if statements | Disabled | The underlying objective is to keep the cognitive complexity low which is better tackled by use of gocognit. | |||||||||||||||||||||
72 | nilerr | Finds the code that returns nil even if it checks that the error is not nil. | Enabled | Can catch genuine error handling bugs. In the case where we want to ignore an error, we can add a comment with the return to keep it explicit. | |||||||||||||||||||||
73 | nilnil ⚙️ | Checks that there is no simultaneous return of nil error and an invalid value. | Disabled | Too many false positives. | |||||||||||||||||||||
74 | nlreturn ⚙️ | nlreturn checks for a new line before return and branch statements to increase code clarity | Disabled | Not able to see the value proposition of mandating style around newline before return statement. | |||||||||||||||||||||
75 | noctx | noctx finds sending http request without context.Context | Enabled | Although there are scenarios where we do not want to cancel an in-flight request on context cancellation, these should be considered the exception rather than the norm. | |||||||||||||||||||||
76 | nolintlint ⚙️ | Reports ill-formed or insufficient nolint directives | Enabled | Not much value in having this for the local golangci-lint config. | # Enable to require nolint directives to mention the specific linter being suppressed. # Default: false require-specific = true | ||||||||||||||||||||
77 | nonamedreturns ⚙️ | Reports all named returns | Disabled | Too stronly opinionated and forbids use of named returns almost completely. | |||||||||||||||||||||
78 | nosprintfhostport | Checks for misuse of Sprintf to construct a host with port in a URL. | Disabled | Value proposition is not positive. The check is highly unlikely to be applicable and useful. | |||||||||||||||||||||
79 | paralleltest ⚙️ | paralleltest detects missing usage of t.Parallel() method in your Go test | Disabled | Packages are already tested in parallel so mandating tests to run in parallel might not be justified. | |||||||||||||||||||||
80 | perfsprint ⚙️ | Checks that fmt.Sprintf can be replaced with a faster alternative. | Enabled | Encourages use of strconv which is more explicit and performant than fmt.Sprintf. | # Optimizes `fmt.Errorf`. # Default: true errorf = false # Optimizes into strings concatenation. # Default: true strconcat = false | ||||||||||||||||||||
81 | prealloc ⚙️ | Finds slice declarations that could potentially be pre-allocated | Disabled | Always reallocating as a rule is hard to justify. | |||||||||||||||||||||
82 | predeclared ⚙️ | find code that shadows one of Go's predeclared identifiers | Disabled | Unlikely to be beneficial as this is not something we have faced at any point. | |||||||||||||||||||||
83 | promlinter ⚙️ | Check Prometheus metrics naming via promlint | Enabled | We can try it out and disable if we there are too many issues reported. | |||||||||||||||||||||
84 | protogetter ⚙️ | Reports direct reads from proto message fields when getters should be used. | Enabled | Can protect against panic when message is not as per expectation | |||||||||||||||||||||
85 | reassign ⚙️ | Checks that package variables are not reassigned | Disabled | Seems very unlikely that the check will catch issues of reassigning package variables since we never do it in practice. | |||||||||||||||||||||
86 | revive ⚙️ | Fast, configurable, extensible, flexible, and beautiful linter for Go. Drop-in replacement of golint. | Enabled | # Sets the default severity. # See https://github.com/mgechev/revive#configuration # Default: warning severity = "error" # Available rules - https://github.com/mgechev/revive/blob/v1.3.1/RULES_DESCRIPTIONS.md [[linters-settings.revive.rules]] # Reduces redundancies around variable declaration. name = "var-declaration" [[linters-settings.revive.rules]] # Warns when a public return is from unexported type. name = "unexported-return" [[linters-settings.revive.rules]] # Disallows blank imports. name = "blank-imports" [[linters-settings.revive.rules]] # context.Context should be the first argument of a function. name = "context-as-argument" [[linters-settings.revive.rules]] # Naming and commenting conventions on exported symbols. name = "exported" [[linters-settings.revive.rules]] # Redundant if when returning an error. name = "if-return" [[linters-settings.revive.rules]] # Use i++ and i-- instead of i += 1 and i -= 1. name = "increment-decrement" [[linters-settings.revive.rules]] # Prevents redundant else statements. name = "indent-error-flow" [[linters-settings.revive.rules]] # Specifies the maximum number of arguments a function can receive. name = "argument-limit" arguments = [5] [[linters-settings.revive.rules]] # Prevents redundant else statements (extends indent-error-flow). name = "superfluous-else" [[linters-settings.revive.rules]] # Warns on methods with names that differ only by capitalization. name = "confusing-naming" [[linters-settings.revive.rules]] # Looks for program exits in funcs other than main() or init(). name = "deep-exit" [[linters-settings.revive.rules]] # Suggests to rename or remove unused function parameters. name = "unused-parameter" [[linters-settings.revive.rules]] # Checks common struct tags like json,xml,yaml. name = "struct-tag" [[linters-settings.revive.rules]] # Warns on assignments to value-passed method receivers. name = "modifies-value-receiver" [[linters-settings.revive.rules]] # Warns on constant logical expressions. name = "constant-logical-expr" [[linters-settings.revive.rules]] # Warns on redefinitions of builtin identifiers. name = "redefines-builtin-id" [[linters-settings.revive.rules]] # Specifies the maximum number of results a function can return. name = "function-result-limit" arguments = [3] [[linters-settings.revive.rules]] # Warns if address of range value is used dangerously. name = "range-val-address" [[linters-settings.revive.rules]] # Warns on explicit call to the garbage collector. name = "call-to-gc" [[linters-settings.revive.rules]] # Spots identifiers that shadow an import. name = "import-shadowing" [[linters-settings.revive.rules]] # Warns on bare returns. name = "bare-return" [[linters-settings.revive.rules]] # Suggests to rename or remove unused method receivers. name = "unused-receiver" [[linters-settings.revive.rules]] # Spots if-then-else statements that can be refactored to simplify code # reading. name = "early-return" [[linters-settings.revive.rules]] # Warns on function calls that will lead to (direct) infinite recursion. name = "unconditional-recursion" [[linters-settings.revive.rules]] # Spots if-then-else statements with identical then and else branches. name = "identical-branches" [[linters-settings.revive.rules]] # Warns on some defer gotchas. name = "defer" arguments = [["loop", "method-call", "recover", "immediate-recover", "return"]] [[linters-settings.revive.rules]] # Warns on wrongly named un-exported symbols. name = "unexported-naming" [[linters-settings.revive.rules]] # Checks inefficient conditional expressions. name = "optimize-operands-order" [[linters-settings.revive.rules]] # Proposes to replace interface{} with its alias any. name = "use-any" [[linters-settings.revive.rules]] # Spots potential dataraces. name = "datarace" [[linters-settings.revive.rules]] # Warns on malformed comments. name = "comment-spacings" [[linters-settings.revive.rules]] # Warns on import aliases matching the imported package name. name = "redundant-import-alias" | |||||||||||||||||||||
87 | rowserrcheck ⚙️ | checks whether Err of rows is checked successfully | Enabled | Error handling related to database access that can get easily missed due to lack of awareness. | # database/sql is always checked # Default: [] packages = [ "github.com/jmoiron/sqlx", ] | ||||||||||||||||||||
88 | sloglint ⚙️ | Ensure consistent code style when using log/slog. | Disabled | We don't use the slog package so this is unlikely to be useful | |||||||||||||||||||||
89 | spancheck ⚙️ | Checks for mistakes with OpenTelemetry/Census spans. | Disabled | We are not using OpenTelemetry yet | |||||||||||||||||||||
90 | sqlclosecheck | Checks that sql.Rows and sql.Stmt are closed. | Enabled | Unclosed rows and statements may cause DB connection pool exhaustion. | |||||||||||||||||||||
91 | stylecheck ⚙️ | Stylecheck is a replacement for golint | Enabled | ||||||||||||||||||||||
92 | tagalign ⚙️ | check that struct tags are well aligned | Disabled | Difficult to integrate into our formatting workflow. | |||||||||||||||||||||
93 | tagliatelle ⚙️ | Checks the struct tags. | Disabled | We don't have an option to enable it on a case-by-case basis starting with just mapstructure. | |||||||||||||||||||||
94 | tenv ⚙️ | tenv is analyzer that detects using os.Setenv instead of t.Setenv since Go1.17 | Enabled | Improves visibility for a relatively unknown useful feature in testing std library. | |||||||||||||||||||||
95 | testableexamples | linter checks if examples are testable (have an expected output) | Disabled | Unlikely to be relevant for our usecase. | |||||||||||||||||||||
96 | testifylint ⚙️ | Checks usage of github.com/stretchr/testify. | Enabled | We use testify but not always in the most optimal fashion. This linter should help bring consistency in some of those aspects. | # Disable all checkers (https://github.com/Antonboom/testifylint#checkers). # Default: false disable-all = true # Enable checkers by name # (in addition to default # blank-import, bool-compare, compares, empty, error-is-as, error-nil, expected-actual, go-require, float-compare, # len, nil-compare, require-error, suite-dont-use-pkg, suite-extra-assert-call, useless-assert # ). enable = [ "blank-import", "bool-compare", "compares", "empty", "error-is-as", "error-nil", "expected-actual", "float-compare", "go-require", "len", "nil-compare", "suite-dont-use-pkg", "suite-extra-assert-call", "useless-assert", ] | ||||||||||||||||||||
97 | testpackage ⚙️ | linter that makes you use a separate _test package | Disabled | There are several services where we test internal implementation details. Until we agree to move away from testing implementation details, we cannot enable this linter. | |||||||||||||||||||||
98 | thelper ⚙️ | thelper detects Go test helpers without t.Helper() call and checks the consistency of test helpers | Enabled | When printing file and line information, the helper function will be skipped - useful. | |||||||||||||||||||||
99 | tparallel | tparallel detects inappropriate usage of t.Parallel() method in your Go test codes | Disabled | Slightly related to 'paralleltest' linter. As we are not proposing to run tests in parallel, this linter would not add much value. | |||||||||||||||||||||
100 | unconvert | Remove unnecessary type conversions | Enabled |