github.com/vanstinator/golangci-lint@v0.0.0-20240223191551-cc572f00d9d1/.golangci.reference.yml (about) 1 # This file contains all available configuration options 2 # with their default values (in comments). 3 # 4 # This file is not a configuration example, 5 # it contains the exhaustive configuration with explanations of the options. 6 7 # Options for analysis running. 8 run: 9 # Number of CPUs to use when running golangci-lint. 10 # Default: the number of logical CPUs in the machine 11 concurrency: 4 12 13 # Timeout for analysis, e.g. 30s, 5m. 14 # Default: 1m 15 timeout: 5m 16 17 # Exit code when at least one issue was found. 18 # Default: 1 19 issues-exit-code: 2 20 21 # Include test files or not. 22 # Default: true 23 tests: false 24 25 # List of build tags, all linters use it. 26 # Default: [] 27 build-tags: 28 - mytag 29 30 # Which dirs to skip: issues from them won't be reported. 31 # Can use regexp here: `generated.*`, regexp is applied on full path, 32 # including the path prefix if one is set. 33 # Default dirs are skipped independently of this option's value (see skip-dirs-use-default). 34 # "/" will be replaced by current OS file path separator to properly work on Windows. 35 # Default: [] 36 skip-dirs: 37 - src/external_libs 38 - autogenerated_by_my_lib 39 40 # Enables skipping of directories: 41 # - vendor$, third_party$, testdata$, examples$, Godeps$, builtin$ 42 # Default: true 43 skip-dirs-use-default: false 44 45 # Which files to skip: they will be analyzed, but issues from them won't be reported. 46 # There is no need to include all autogenerated files, 47 # we confidently recognize autogenerated files. 48 # If it's not, please let us know. 49 # "/" will be replaced by current OS file path separator to properly work on Windows. 50 # Default: [] 51 skip-files: 52 - ".*\\.my\\.go$" 53 - lib/bad.go 54 55 # If set, we pass it to "go list -mod={option}". From "go help modules": 56 # If invoked with -mod=readonly, the go command is disallowed from the implicit 57 # automatic updating of go.mod described above. Instead, it fails when any changes 58 # to go.mod are needed. This setting is most useful to check that go.mod does 59 # not need updates, such as in a continuous integration and testing system. 60 # If invoked with -mod=vendor, the go command assumes that the vendor 61 # directory holds the correct copies of dependencies and ignores 62 # the dependency descriptions in go.mod. 63 # 64 # Allowed values: readonly|vendor|mod 65 # Default: "" 66 modules-download-mode: readonly 67 68 # Allow multiple parallel golangci-lint instances running. 69 # If false, golangci-lint acquires file lock on start. 70 # Default: false 71 allow-parallel-runners: false 72 73 # Allow multiple golangci-lint instances running, but serialize them around a lock. 74 # If false, golangci-lint exits with an error if it fails to acquire file lock on start. 75 # Default: false 76 allow-serial-runners: true 77 78 # Print avg and max memory usage of golangci-lint and total time. 79 # Default: false 80 print-resources-usage: true 81 82 # Define the Go version limit. 83 # Mainly related to generics support since go1.18. 84 # Default: use Go version from the go.mod file, fallback on the env var `GOVERSION`, fallback on 1.17 85 go: '1.19' 86 87 88 # output configuration options 89 output: 90 # Format: colored-line-number|line-number|json|colored-tab|tab|checkstyle|code-climate|junit-xml|github-actions|teamcity 91 # 92 # Multiple can be specified by separating them by comma, output can be provided 93 # for each of them by separating format name and path by colon symbol. 94 # Output path can be either `stdout`, `stderr` or path to the file to write to. 95 # Example: "checkstyle:report.xml,json:stdout,colored-line-number" 96 # 97 # Default: colored-line-number 98 format: json 99 100 # Print lines of code with issue. 101 # Default: true 102 print-issued-lines: false 103 104 # Print linter name in the end of issue text. 105 # Default: true 106 print-linter-name: false 107 108 # Make issues output unique by line. 109 # Default: true 110 uniq-by-line: false 111 112 # Add a prefix to the output file references. 113 # Default: "" 114 path-prefix: "" 115 116 # Sort results by: filepath, line and column. 117 # Default: false 118 sort-results: true 119 120 121 # All available settings of specific linters. 122 linters-settings: 123 asasalint: 124 # To specify a set of function names to exclude. 125 # The values are merged with the builtin exclusions. 126 # The builtin exclusions can be disabled by setting `use-builtin-exclusions` to `false`. 127 # Default: ["^(fmt|log|logger|t|)\.(Print|Fprint|Sprint|Fatal|Panic|Error|Warn|Warning|Info|Debug|Log)(|f|ln)$"] 128 exclude: 129 - Append 130 - \.Wrapf 131 # To enable/disable the asasalint builtin exclusions of function names. 132 # See the default value of `exclude` to get the builtin exclusions. 133 # Default: true 134 use-builtin-exclusions: false 135 # Ignore *_test.go files. 136 # Default: false 137 ignore-test: true 138 139 bidichk: 140 # The following configurations check for all mentioned invisible unicode runes. 141 # All runes are enabled by default. 142 left-to-right-embedding: false 143 right-to-left-embedding: false 144 pop-directional-formatting: false 145 left-to-right-override: false 146 right-to-left-override: false 147 left-to-right-isolate: false 148 right-to-left-isolate: false 149 first-strong-isolate: false 150 pop-directional-isolate: false 151 152 cyclop: 153 # The maximal code complexity to report. 154 # Default: 10 155 max-complexity: 10 156 # The maximal average package complexity. 157 # If it's higher than 0.0 (float) the check is enabled 158 # Default: 0.0 159 package-average: 0.5 160 # Should ignore tests. 161 # Default: false 162 skip-tests: true 163 164 decorder: 165 # Required order of `type`, `const`, `var` and `func` declarations inside a file. 166 # Default: types before constants before variables before functions. 167 dec-order: 168 - type 169 - const 170 - var 171 - func 172 173 # If true, underscore vars (vars with "_" as the name) will be ignored at all checks 174 # Default: false (underscore vars are not ignored) 175 ignore-underscore-vars: false 176 177 # If true, order of declarations is not checked at all. 178 # Default: true (disabled) 179 disable-dec-order-check: false 180 181 # If true, `init` func can be anywhere in file (does not have to be declared before all other functions). 182 # Default: true (disabled) 183 disable-init-func-first-check: false 184 185 # If true, multiple global `type`, `const` and `var` declarations are allowed. 186 # Default: true (disabled) 187 disable-dec-num-check: false 188 189 # If true, type declarations will be ignored for dec num check 190 # Default: false (type statements are not ignored) 191 disable-type-dec-num-check: false 192 193 # If true, const declarations will be ignored for dec num check 194 # Default: false (const statements are not ignored) 195 disable-const-dec-num-check: false 196 197 # If true, var declarations will be ignored for dec num check 198 # Default: false (var statements are not ignored) 199 disable-var-dec-num-check: false 200 201 depguard: 202 # Rules to apply. 203 # 204 # Variables: 205 # - File Variables 206 # you can still use and exclamation mark ! in front of a variable to say not to use it. 207 # Example !$test will match any file that is not a go test file. 208 # 209 # `$all` - matches all go files 210 # `$test` - matches all go test files 211 # 212 # - Package Variables 213 # 214 # `$gostd` - matches all of go's standard library (Pulled from `GOROOT`) 215 # 216 # Default: Only allow $gostd in all files. 217 rules: 218 # Name of a rule. 219 main: 220 # Used to determine the package matching priority. 221 # There are three different modes: `original`, `strict`, and `lax`. 222 # Default: "original" 223 list-mode: lax 224 # List of file globs that will match this list of settings to compare against. 225 # Default: $all 226 files: 227 - "!**/*_a _file.go" 228 # List of allowed packages. 229 allow: 230 - $gostd 231 - github.com/OpenPeeDeeP 232 # Packages that are not allowed where the value is a suggestion. 233 deny: 234 - pkg: "github.com/sirupsen/logrus" 235 desc: not allowed 236 - pkg: "github.com/pkg/errors" 237 desc: Should be replaced by standard lib errors package 238 239 dogsled: 240 # Checks assignments with too many blank identifiers. 241 # Default: 2 242 max-blank-identifiers: 3 243 244 dupl: 245 # Tokens count to trigger issue. 246 # Default: 150 247 threshold: 100 248 249 dupword: 250 # Keywords for detecting duplicate words. 251 # If this list is not empty, only the words defined in this list will be detected. 252 # Default: [] 253 keywords: 254 - "the" 255 - "and" 256 - "a" 257 # Keywords used to ignore detection. 258 # Default: [] 259 ignore: 260 - "0C0C" 261 262 errcheck: 263 # Report about not checking of errors in type assertions: `a := b.(MyStruct)`. 264 # Such cases aren't reported by default. 265 # Default: false 266 check-type-assertions: true 267 268 # report about assignment of errors to blank identifier: `num, _ := strconv.Atoi(numStr)`. 269 # Such cases aren't reported by default. 270 # Default: false 271 check-blank: true 272 273 # DEPRECATED comma-separated list of pairs of the form pkg:regex 274 # 275 # the regex is used to ignore names within pkg. (default "fmt:.*"). 276 # see https://github.com/kisielk/errcheck#the-deprecated-method for details 277 ignore: fmt:.*,io/ioutil:^Read.* 278 279 # To disable the errcheck built-in exclude list. 280 # See `-excludeonly` option in https://github.com/kisielk/errcheck#excluding-functions for details. 281 # Default: false 282 disable-default-exclusions: true 283 284 # DEPRECATED use exclude-functions instead. 285 # 286 # Path to a file containing a list of functions to exclude from checking. 287 # See https://github.com/kisielk/errcheck#excluding-functions for details. 288 exclude: /path/to/file.txt 289 290 # List of functions to exclude from checking, where each entry is a single function to exclude. 291 # See https://github.com/kisielk/errcheck#excluding-functions for details. 292 exclude-functions: 293 - io/ioutil.ReadFile 294 - io.Copy(*bytes.Buffer) 295 - io.Copy(os.Stdout) 296 297 errchkjson: 298 # With check-error-free-encoding set to true, errchkjson does warn about errors 299 # from json encoding functions that are safe to be ignored, 300 # because they are not possible to happen. 301 # 302 # if check-error-free-encoding is set to true and errcheck linter is enabled, 303 # it is recommended to add the following exceptions to prevent from false positives: 304 # 305 # linters-settings: 306 # errcheck: 307 # exclude-functions: 308 # - encoding/json.Marshal 309 # - encoding/json.MarshalIndent 310 # 311 # Default: false 312 check-error-free-encoding: true 313 314 # Issue on struct encoding that doesn't have exported fields. 315 # Default: false 316 report-no-exported: false 317 318 errorlint: 319 # Check whether fmt.Errorf uses the %w verb for formatting errors. 320 # See the https://github.com/polyfloyd/go-errorlint for caveats. 321 # Default: true 322 errorf: false 323 # Permit more than 1 %w verb, valid per Go 1.20 (Requires errorf:true) 324 # Default: true 325 errorf-multi: false 326 # Check for plain type assertions and type switches. 327 # Default: true 328 asserts: false 329 # Check for plain error comparisons. 330 # Default: true 331 comparison: false 332 333 exhaustive: 334 # Program elements to check for exhaustiveness. 335 # Default: [ switch ] 336 check: 337 - switch 338 - map 339 # Check switch statements in generated files also. 340 # Default: false 341 check-generated: true 342 # Presence of "default" case in switch statements satisfies exhaustiveness, 343 # even if all enum members are not listed. 344 # Default: false 345 default-signifies-exhaustive: true 346 # Enum members matching the supplied regex do not have to be listed in 347 # switch statements to satisfy exhaustiveness. 348 # Default: "" 349 ignore-enum-members: "Example.+" 350 # Enum types matching the supplied regex do not have to be listed in 351 # switch statements to satisfy exhaustiveness. 352 # Default: "" 353 ignore-enum-types: "Example.+" 354 # Consider enums only in package scopes, not in inner scopes. 355 # Default: false 356 package-scope-only: true 357 # Only run exhaustive check on switches with "//exhaustive:enforce" comment. 358 # Default: false 359 explicit-exhaustive-switch: true 360 # Only run exhaustive check on map literals with "//exhaustive:enforce" comment. 361 # Default: false 362 explicit-exhaustive-map: true 363 # Switch statement requires default case even if exhaustive. 364 # Default: false 365 default-case-required: true 366 367 exhaustivestruct: 368 # Struct Patterns is list of expressions to match struct packages and names. 369 # The struct packages have the form `example.com/package.ExampleStruct`. 370 # The matching patterns can use matching syntax from https://pkg.go.dev/path#Match. 371 # If this list is empty, all structs are tested. 372 # Default: [] 373 struct-patterns: 374 - '*.Test' 375 - 'example.com/package.ExampleStruct' 376 377 exhaustruct: 378 # List of regular expressions to match struct packages and their names. 379 # Regular expressions must match complete canonical struct package/name/structname. 380 # If this list is empty, all structs are tested. 381 # Default: [] 382 include: 383 - '.+\.Test' 384 - 'example\.com/package\.ExampleStruct[\d]{1,2}' 385 # List of regular expressions to exclude struct packages and their names from checks. 386 # Regular expressions must match complete canonical struct package/name/structname. 387 # Default: [] 388 exclude: 389 - '.+/cobra\.Command$' 390 391 forbidigo: 392 # Forbid the following identifiers (list of regexp). 393 # Default: ["^(fmt\\.Print(|f|ln)|print|println)$"] 394 forbid: 395 # Builtin function: 396 - ^print.*$ 397 # Optional message that gets included in error reports. 398 - p: ^fmt\.Print.*$ 399 msg: Do not commit print statements. 400 # Alternatively, put messages at the end of the regex, surrounded by `(# )?` 401 # Escape any special characters. Those messages get included in error reports. 402 - 'fmt\.Print.*(# Do not commit print statements\.)?' 403 # Forbid spew Dump, whether it is called as function or method. 404 # Depends on analyze-types below. 405 - ^spew\.(ConfigState\.)?Dump$ 406 # The package name might be ambiguous. 407 # The full import path can be used as additional criteria. 408 # Depends on analyze-types below. 409 - p: ^v1.Dump$ 410 pkg: ^example.com/pkg/api/v1$ 411 # Exclude godoc examples from forbidigo checks. 412 # Default: true 413 exclude-godoc-examples: false 414 # Instead of matching the literal source code, 415 # use type information to replace expressions with strings that contain the package name 416 # and (for methods and fields) the type name. 417 # This makes it possible to handle import renaming and forbid struct fields and methods. 418 # Default: false 419 analyze-types: true 420 421 funlen: 422 # Checks the number of lines in a function. 423 # If lower than 0, disable the check. 424 # Default: 60 425 lines: -1 426 # Checks the number of statements in a function. 427 # If lower than 0, disable the check. 428 # Default: 40 429 statements: -1 430 # Ignore comments when counting lines. 431 # Default false 432 ignore-comments: true 433 434 gci: 435 # DEPRECATED: use `sections` and `prefix(github.com/org/project)` instead. 436 local-prefixes: github.com/org/project 437 438 # Section configuration to compare against. 439 # Section names are case-insensitive and may contain parameters in (). 440 # The default order of sections is `standard > default > custom > blank > dot > alias`, 441 # If `custom-order` is `true`, it follows the order of `sections` option. 442 # Default: ["standard", "default"] 443 sections: 444 - standard # Standard section: captures all standard packages. 445 - default # Default section: contains all imports that could not be matched to another section type. 446 - prefix(github.com/org/project) # Custom section: groups all imports with the specified Prefix. 447 - blank # Blank section: contains all blank imports. This section is not present unless explicitly enabled. 448 - dot # Dot section: contains all dot imports. This section is not present unless explicitly enabled. 449 - alias # Alias section: contains all alias imports. This section is not present unless explicitly enabled. 450 451 # Skip generated files. 452 # Default: true 453 skip-generated: false 454 455 # Enable custom order of sections. 456 # If `true`, make the section order the same as the order of `sections`. 457 # Default: false 458 custom-order: true 459 460 ginkgolinter: 461 # Suppress the wrong length assertion warning. 462 # Default: false 463 suppress-len-assertion: true 464 465 # Suppress the wrong nil assertion warning. 466 # Default: false 467 suppress-nil-assertion: true 468 469 # Suppress the wrong error assertion warning. 470 # Default: false 471 suppress-err-assertion: true 472 473 # Suppress the wrong comparison assertion warning. 474 # Default: false 475 suppress-compare-assertion: true 476 477 # Suppress the function all in async assertion warning. 478 # Default: false 479 suppress-async-assertion: true 480 481 # Suppress warning for comparing values from different types, like int32 and uint32 482 # Default: false 483 suppress-type-compare-assertion: true 484 485 # Trigger warning for ginkgo focus containers like FDescribe, FContext, FWhen or FIt 486 # Default: false 487 forbid-focus-container: true 488 489 # Don't trigger warnings for HaveLen(0) 490 # Default: false 491 allow-havelen-zero: true 492 493 gocognit: 494 # Minimal code complexity to report. 495 # Default: 30 (but we recommend 10-20) 496 min-complexity: 10 497 498 goconst: 499 # Minimal length of string constant. 500 # Default: 3 501 min-len: 2 502 # Minimum occurrences of constant string count to trigger issue. 503 # Default: 3 504 min-occurrences: 2 505 # Ignore test files. 506 # Default: false 507 ignore-tests: true 508 # Look for existing constants matching the values. 509 # Default: true 510 match-constant: false 511 # Search also for duplicated numbers. 512 # Default: false 513 numbers: true 514 # Minimum value, only works with goconst.numbers 515 # Default: 3 516 min: 2 517 # Maximum value, only works with goconst.numbers 518 # Default: 3 519 max: 2 520 # Ignore when constant is not used as function argument. 521 # Default: true 522 ignore-calls: false 523 # Exclude strings matching the given regular expression. 524 # Default: "" 525 ignore-strings: 'foo.+' 526 527 gocritic: 528 # Which checks should be enabled; can't be combined with 'disabled-checks'. 529 # See https://go-critic.github.io/overview#checks-overview. 530 # To check which checks are enabled run `GL_DEBUG=gocritic golangci-lint run`. 531 # By default, list of stable checks is used. 532 enabled-checks: 533 - nestingReduce 534 - unnamedResult 535 - ruleguard 536 - truncateCmp 537 538 # Which checks should be disabled; can't be combined with 'enabled-checks'. 539 # Default: [] 540 disabled-checks: 541 - regexpMust 542 543 # Enable multiple checks by tags, run `GL_DEBUG=gocritic golangci-lint run` to see all tags and checks. 544 # See https://github.com/go-critic/go-critic#usage -> section "Tags". 545 # Default: [] 546 enabled-tags: 547 - diagnostic 548 - style 549 - performance 550 - experimental 551 - opinionated 552 disabled-tags: 553 - diagnostic 554 - style 555 - performance 556 - experimental 557 - opinionated 558 559 # Settings passed to gocritic. 560 # The settings key is the name of a supported gocritic checker. 561 # The list of supported checkers can be find in https://go-critic.github.io/overview. 562 settings: 563 # Must be valid enabled check name. 564 captLocal: 565 # Whether to restrict checker to params only. 566 # Default: true 567 paramsOnly: false 568 commentedOutCode: 569 # Min length of the comment that triggers a warning. 570 # Default: 15 571 minLength: 50 572 elseif: 573 # Whether to skip balanced if-else pairs. 574 # Default: true 575 skipBalanced: false 576 hugeParam: 577 # Size in bytes that makes the warning trigger. 578 # Default: 80 579 sizeThreshold: 70 580 ifElseChain: 581 # Min number of if-else blocks that makes the warning trigger. 582 # Default: 2 583 minThreshold: 4 584 nestingReduce: 585 # Min number of statements inside a branch to trigger a warning. 586 # Default: 5 587 bodyWidth: 4 588 rangeExprCopy: 589 # Size in bytes that makes the warning trigger. 590 # Default: 512 591 sizeThreshold: 516 592 # Whether to check test functions 593 # Default: true 594 skipTestFuncs: false 595 rangeValCopy: 596 # Size in bytes that makes the warning trigger. 597 # Default: 128 598 sizeThreshold: 32 599 # Whether to check test functions. 600 # Default: true 601 skipTestFuncs: false 602 ruleguard: 603 # Enable debug to identify which 'Where' condition was rejected. 604 # The value of the parameter is the name of a function in a ruleguard file. 605 # 606 # When a rule is evaluated: 607 # If: 608 # The Match() clause is accepted; and 609 # One of the conditions in the Where() clause is rejected, 610 # Then: 611 # ruleguard prints the specific Where() condition that was rejected. 612 # 613 # The option is passed to the ruleguard 'debug-group' argument. 614 # Default: "" 615 debug: 'emptyDecl' 616 # Deprecated, use 'failOn' param. 617 # If set to true, identical to failOn='all', otherwise failOn='' 618 failOnError: false 619 # Determines the behavior when an error occurs while parsing ruleguard files. 620 # If flag is not set, log error and skip rule files that contain an error. 621 # If flag is set, the value must be a comma-separated list of error conditions. 622 # - 'all': fail on all errors. 623 # - 'import': ruleguard rule imports a package that cannot be found. 624 # - 'dsl': gorule file does not comply with the ruleguard DSL. 625 # Default: "" 626 failOn: dsl 627 # Comma-separated list of file paths containing ruleguard rules. 628 # If a path is relative, it is relative to the directory where the golangci-lint command is executed. 629 # The special '${configDir}' variable is substituted with the absolute directory containing the golangci config file. 630 # Glob patterns such as 'rules-*.go' may be specified. 631 # Default: "" 632 rules: '${configDir}/ruleguard/rules-*.go,${configDir}/myrule1.go' 633 # Comma-separated list of enabled groups or skip empty to enable everything. 634 # Tags can be defined with # character prefix. 635 # Default: "<all>" 636 enable: "myGroupName,#myTagName" 637 # Comma-separated list of disabled groups or skip empty to enable everything. 638 # Tags can be defined with # character prefix. 639 # Default: "" 640 disable: "myGroupName,#myTagName" 641 tooManyResultsChecker: 642 # Maximum number of results. 643 # Default: 5 644 maxResults: 10 645 truncateCmp: 646 # Whether to skip int/uint/uintptr types. 647 # Default: true 648 skipArchDependent: false 649 underef: 650 # Whether to skip (*x).method() calls where x is a pointer receiver. 651 # Default: true 652 skipRecvDeref: false 653 unnamedResult: 654 # Whether to check exported functions. 655 # Default: false 656 checkExported: true 657 658 gocyclo: 659 # Minimal code complexity to report. 660 # Default: 30 (but we recommend 10-20) 661 min-complexity: 10 662 663 godot: 664 # Comments to be checked: `declarations`, `toplevel`, or `all`. 665 # Default: declarations 666 scope: toplevel 667 # List of regexps for excluding particular comment lines from check. 668 # Default: [] 669 exclude: 670 # Exclude todo and fixme comments. 671 - "^fixme:" 672 - "^todo:" 673 # Check that each sentence ends with a period. 674 # Default: true 675 period: false 676 # Check that each sentence starts with a capital letter. 677 # Default: false 678 capital: true 679 680 godox: 681 # Report any comments starting with keywords, this is useful for TODO or FIXME comments that 682 # might be left in the code accidentally and should be resolved before merging. 683 # Default: ["TODO", "BUG", "FIXME"] 684 keywords: 685 - NOTE 686 - OPTIMIZE # marks code that should be optimized before merging 687 - HACK # marks hack-around that should be removed before merging 688 689 gofmt: 690 # Simplify code: gofmt with `-s` option. 691 # Default: true 692 simplify: false 693 # Apply the rewrite rules to the source before reformatting. 694 # https://pkg.go.dev/cmd/gofmt 695 # Default: [] 696 rewrite-rules: 697 - pattern: 'interface{}' 698 replacement: 'any' 699 - pattern: 'a[b:len(a)]' 700 replacement: 'a[b:]' 701 702 gofumpt: 703 # Deprecated: use the global `run.go` instead. 704 lang-version: "1.17" 705 706 # Module path which contains the source code being formatted. 707 # Default: "" 708 module-path: github.com/org/project 709 710 # Choose whether to use the extra rules. 711 # Default: false 712 extra-rules: true 713 714 goheader: 715 # Supports two types 'const` and `regexp`. 716 # Values can be used recursively. 717 # Default: {} 718 values: 719 const: 720 # Define here const type values in format k:v. 721 # For example: 722 COMPANY: MY COMPANY 723 regexp: 724 # Define here regexp type values. 725 # for example: 726 AUTHOR: .*@mycompany\.com 727 # The template use for checking. 728 # Default: "" 729 template: |- 730 # Put here copyright header template for source code files 731 # For example: 732 # Note: {{ YEAR }} is a builtin value that returns the year relative to the current machine time. 733 # 734 # {{ AUTHOR }} {{ COMPANY }} {{ YEAR }} 735 # SPDX-License-Identifier: Apache-2.0 736 737 # Licensed under the Apache License, Version 2.0 (the "License"); 738 # you may not use this file except in compliance with the License. 739 # You may obtain a copy of the License at: 740 741 # http://www.apache.org/licenses/LICENSE-2.0 742 743 # Unless required by applicable law or agreed to in writing, software 744 # distributed under the License is distributed on an "AS IS" BASIS, 745 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 746 # See the License for the specific language governing permissions and 747 # limitations under the License. 748 # As alternative of directive 'template', you may put the path to file with the template source. 749 # Useful if you need to load the template from a specific file. 750 # Default: "" 751 template-path: /path/to/my/template.tmpl 752 753 goimports: 754 # A comma-separated list of prefixes, which, if set, checks import paths 755 # with the given prefixes are grouped after 3rd-party packages. 756 # Default: "" 757 local-prefixes: github.com/org/project 758 759 golint: 760 # Minimal confidence for issues. 761 # Default: 0.8 762 min-confidence: 0.7 763 764 gomnd: 765 # List of enabled checks, see https://github.com/tommy-muehle/go-mnd/#checks for description. 766 # Default: ["argument", "case", "condition", "operation", "return", "assign"] 767 checks: 768 - argument 769 - case 770 - condition 771 - operation 772 - return 773 - assign 774 # List of numbers to exclude from analysis. 775 # The numbers should be written as string. 776 # Values always ignored: "1", "1.0", "0" and "0.0" 777 # Default: [] 778 ignored-numbers: 779 - '0666' 780 - '0755' 781 - '42' 782 # List of file patterns to exclude from analysis. 783 # Values always ignored: `.+_test.go` 784 # Default: [] 785 ignored-files: 786 - 'magic1_.+\.go$' 787 # List of function patterns to exclude from analysis. 788 # Following functions are always ignored: `time.Date`, 789 # `strconv.FormatInt`, `strconv.FormatUint`, `strconv.FormatFloat`, 790 # `strconv.ParseInt`, `strconv.ParseUint`, `strconv.ParseFloat`. 791 # Default: [] 792 ignored-functions: 793 - '^math\.' 794 - '^http\.StatusText$' 795 796 gomoddirectives: 797 # Allow local `replace` directives. 798 # Default: false 799 replace-local: false 800 # List of allowed `replace` directives. 801 # Default: [] 802 replace-allow-list: 803 - launchpad.net/gocheck 804 # Allow to not explain why the version has been retracted in the `retract` directives. 805 # Default: false 806 retract-allow-no-explanation: false 807 # Forbid the use of the `exclude` directives. 808 # Default: false 809 exclude-forbidden: false 810 811 gomodguard: 812 allowed: 813 # List of allowed modules. 814 # Default: [] 815 modules: 816 - gopkg.in/yaml.v2 817 # List of allowed module domains. 818 # Default: [] 819 domains: 820 - golang.org 821 blocked: 822 # List of blocked modules. 823 # Default: [] 824 modules: 825 # Blocked module. 826 - github.com/uudashr/go-module: 827 # Recommended modules that should be used instead. (Optional) 828 recommendations: 829 - golang.org/x/mod 830 # Reason why the recommended module should be used. (Optional) 831 reason: "`mod` is the official go.mod parser library." 832 # List of blocked module version constraints. 833 # Default: [] 834 versions: 835 # Blocked module with version constraint. 836 - github.com/mitchellh/go-homedir: 837 # Version constraint, see https://github.com/Masterminds/semver#basic-comparisons. 838 version: "< 1.1.0" 839 # Reason why the version constraint exists. (Optional) 840 reason: "testing if blocked version constraint works." 841 # Set to true to raise lint issues for packages that are loaded from a local path via replace directive. 842 # Default: false 843 local_replace_directives: false 844 845 gosimple: 846 # Deprecated: use the global `run.go` instead. 847 go: "1.15" 848 # Sxxxx checks in https://staticcheck.io/docs/configuration/options/#checks 849 # Default: ["*"] 850 checks: [ "all" ] 851 852 gosec: 853 # To select a subset of rules to run. 854 # Available rules: https://github.com/securego/gosec#available-rules 855 # Default: [] - means include all rules 856 includes: 857 - G101 # Look for hard coded credentials 858 - G102 # Bind to all interfaces 859 - G103 # Audit the use of unsafe block 860 - G104 # Audit errors not checked 861 - G106 # Audit the use of ssh.InsecureIgnoreHostKey 862 - G107 # Url provided to HTTP request as taint input 863 - G108 # Profiling endpoint automatically exposed on /debug/pprof 864 - G109 # Potential Integer overflow made by strconv.Atoi result conversion to int16/32 865 - G110 # Potential DoS vulnerability via decompression bomb 866 - G111 # Potential directory traversal 867 - G112 # Potential slowloris attack 868 - G113 # Usage of Rat.SetString in math/big with an overflow (CVE-2022-23772) 869 - G114 # Use of net/http serve function that has no support for setting timeouts 870 - G201 # SQL query construction using format string 871 - G202 # SQL query construction using string concatenation 872 - G203 # Use of unescaped data in HTML templates 873 - G204 # Audit use of command execution 874 - G301 # Poor file permissions used when creating a directory 875 - G302 # Poor file permissions used with chmod 876 - G303 # Creating tempfile using a predictable path 877 - G304 # File path provided as taint input 878 - G305 # File traversal when extracting zip/tar archive 879 - G306 # Poor file permissions used when writing to a new file 880 - G307 # Poor file permissions used when creating a file with os.Create 881 - G401 # Detect the usage of DES, RC4, MD5 or SHA1 882 - G402 # Look for bad TLS connection settings 883 - G403 # Ensure minimum RSA key length of 2048 bits 884 - G404 # Insecure random number source (rand) 885 - G501 # Import blocklist: crypto/md5 886 - G502 # Import blocklist: crypto/des 887 - G503 # Import blocklist: crypto/rc4 888 - G504 # Import blocklist: net/http/cgi 889 - G505 # Import blocklist: crypto/sha1 890 - G601 # Implicit memory aliasing of items from a range statement 891 - G602 # Slice access out of bounds 892 893 # To specify a set of rules to explicitly exclude. 894 # Available rules: https://github.com/securego/gosec#available-rules 895 # Default: [] 896 excludes: 897 - G101 # Look for hard coded credentials 898 - G102 # Bind to all interfaces 899 - G103 # Audit the use of unsafe block 900 - G104 # Audit errors not checked 901 - G106 # Audit the use of ssh.InsecureIgnoreHostKey 902 - G107 # Url provided to HTTP request as taint input 903 - G108 # Profiling endpoint automatically exposed on /debug/pprof 904 - G109 # Potential Integer overflow made by strconv.Atoi result conversion to int16/32 905 - G110 # Potential DoS vulnerability via decompression bomb 906 - G111 # Potential directory traversal 907 - G112 # Potential slowloris attack 908 - G113 # Usage of Rat.SetString in math/big with an overflow (CVE-2022-23772) 909 - G114 # Use of net/http serve function that has no support for setting timeouts 910 - G201 # SQL query construction using format string 911 - G202 # SQL query construction using string concatenation 912 - G203 # Use of unescaped data in HTML templates 913 - G204 # Audit use of command execution 914 - G301 # Poor file permissions used when creating a directory 915 - G302 # Poor file permissions used with chmod 916 - G303 # Creating tempfile using a predictable path 917 - G304 # File path provided as taint input 918 - G305 # File traversal when extracting zip/tar archive 919 - G306 # Poor file permissions used when writing to a new file 920 - G307 # Poor file permissions used when creating a file with os.Create 921 - G401 # Detect the usage of DES, RC4, MD5 or SHA1 922 - G402 # Look for bad TLS connection settings 923 - G403 # Ensure minimum RSA key length of 2048 bits 924 - G404 # Insecure random number source (rand) 925 - G501 # Import blocklist: crypto/md5 926 - G502 # Import blocklist: crypto/des 927 - G503 # Import blocklist: crypto/rc4 928 - G504 # Import blocklist: net/http/cgi 929 - G505 # Import blocklist: crypto/sha1 930 - G601 # Implicit memory aliasing of items from a range statement 931 - G602 # Slice access out of bounds 932 933 # Exclude generated files 934 # Default: false 935 exclude-generated: true 936 937 # Filter out the issues with a lower severity than the given value. 938 # Valid options are: low, medium, high. 939 # Default: low 940 severity: medium 941 942 # Filter out the issues with a lower confidence than the given value. 943 # Valid options are: low, medium, high. 944 # Default: low 945 confidence: medium 946 947 # Concurrency value. 948 # Default: the number of logical CPUs usable by the current process. 949 concurrency: 12 950 951 # To specify the configuration of rules. 952 config: 953 # Globals are applicable to all rules. 954 global: 955 # If true, ignore #nosec in comments (and an alternative as well). 956 # Default: false 957 nosec: true 958 # Add an alternative comment prefix to #nosec (both will work at the same time). 959 # Default: "" 960 "#nosec": "#my-custom-nosec" 961 # Define whether nosec issues are counted as finding or not. 962 # Default: false 963 show-ignored: true 964 # Audit mode enables addition checks that for normal code analysis might be too nosy. 965 # Default: false 966 audit: true 967 G101: 968 # Regexp pattern for variables and constants to find. 969 # Default: "(?i)passwd|pass|password|pwd|secret|token|pw|apiKey|bearer|cred" 970 pattern: "(?i)example" 971 # If true, complain about all cases (even with low entropy). 972 # Default: false 973 ignore_entropy: false 974 # Maximum allowed entropy of the string. 975 # Default: "80.0" 976 entropy_threshold: "80.0" 977 # Maximum allowed value of entropy/string length. 978 # Is taken into account if entropy >= entropy_threshold/2. 979 # Default: "3.0" 980 per_char_threshold: "3.0" 981 # Calculate entropy for first N chars of the string. 982 # Default: "16" 983 truncate: "32" 984 # Additional functions to ignore while checking unhandled errors. 985 # Following functions always ignored: 986 # bytes.Buffer: 987 # - Write 988 # - WriteByte 989 # - WriteRune 990 # - WriteString 991 # fmt: 992 # - Print 993 # - Printf 994 # - Println 995 # - Fprint 996 # - Fprintf 997 # - Fprintln 998 # strings.Builder: 999 # - Write 1000 # - WriteByte 1001 # - WriteRune 1002 # - WriteString 1003 # io.PipeWriter: 1004 # - CloseWithError 1005 # hash.Hash: 1006 # - Write 1007 # os: 1008 # - Unsetenv 1009 # Default: {} 1010 G104: 1011 fmt: 1012 - Fscanf 1013 G111: 1014 # Regexp pattern to find potential directory traversal. 1015 # Default: "http\\.Dir\\(\"\\/\"\\)|http\\.Dir\\('\\/'\\)" 1016 pattern: "custom\\.Dir\\(\\)" 1017 # Maximum allowed permissions mode for os.Mkdir and os.MkdirAll 1018 # Default: "0750" 1019 G301: "0750" 1020 # Maximum allowed permissions mode for os.OpenFile and os.Chmod 1021 # Default: "0600" 1022 G302: "0600" 1023 # Maximum allowed permissions mode for os.WriteFile and ioutil.WriteFile 1024 # Default: "0600" 1025 G306: "0600" 1026 1027 gosmopolitan: 1028 # Allow and ignore `time.Local` usages. 1029 # 1030 # Default: false 1031 allow-time-local: true 1032 # List of fully qualified names in the `full/pkg/path.name` form, to act as "i18n escape hatches". 1033 # String literals inside call-like expressions to, or struct literals of those names, 1034 # are exempt from the writing system check. 1035 # 1036 # Default: [] 1037 escape-hatches: 1038 - 'github.com/nicksnyder/go-i18n/v2/i18n.Message' 1039 - 'example.com/your/project/i18n/markers.Raw' 1040 - 'example.com/your/project/i18n/markers.OK' 1041 - 'example.com/your/project/i18n/markers.TODO' 1042 - 'command-line-arguments.Simple' 1043 # Ignore test files. 1044 # 1045 # Default: true 1046 ignore-tests: false 1047 # List of Unicode scripts to watch for any usage in string literals. 1048 # https://pkg.go.dev/unicode#pkg-variables 1049 # 1050 # Default: ["Han"] 1051 watch-for-scripts: 1052 - Devanagari 1053 - Han 1054 - Hangul 1055 - Hiragana 1056 - Katakana 1057 1058 govet: 1059 # Report about shadowed variables. 1060 # Default: false 1061 check-shadowing: true 1062 1063 # Settings per analyzer. 1064 settings: 1065 # Analyzer name, run `go tool vet help` to see all analyzers. 1066 printf: 1067 # Comma-separated list of print function names to check (in addition to default, see `go tool vet help printf`). 1068 # Default: [] 1069 funcs: 1070 - (github.com/vanstinator/golangci-lint/pkg/logutils.Log).Infof 1071 - (github.com/vanstinator/golangci-lint/pkg/logutils.Log).Warnf 1072 - (github.com/vanstinator/golangci-lint/pkg/logutils.Log).Errorf 1073 - (github.com/vanstinator/golangci-lint/pkg/logutils.Log).Fatalf 1074 shadow: 1075 # Whether to be strict about shadowing; can be noisy. 1076 # Default: false 1077 strict: true 1078 unusedresult: 1079 # Comma-separated list of functions whose results must be used 1080 # (in addition to default: 1081 # context.WithCancel, context.WithDeadline, context.WithTimeout, context.WithValue, errors.New, fmt.Errorf, 1082 # fmt.Sprint, fmt.Sprintf, sort.Reverse 1083 # ). 1084 # Default: [] 1085 funcs: 1086 - pkg.MyFunc 1087 # Comma-separated list of names of methods of type func() string whose results must be used 1088 # (in addition to default Error,String) 1089 # Default: [] 1090 stringmethods: 1091 - MyMethod 1092 1093 # Disable all analyzers. 1094 # Default: false 1095 disable-all: true 1096 # Enable analyzers by name. 1097 # (in addition to default: 1098 # appends, asmdecl, assign, atomic, bools, buildtag, cgocall, composites, copylocks, defers, directive, errorsas, 1099 # framepointer, httpresponse, ifaceassert, loopclosure, lostcancel, nilfunc, printf, shift, sigchanyzer, slog, 1100 # stdmethods, stringintconv, structtag, testinggoroutine, tests, timeformat, unmarshal, unreachable, unsafeptr, 1101 # unusedresult 1102 # ). 1103 # Run `go tool vet help` to see all analyzers. 1104 # Default: [] 1105 enable: 1106 - appends 1107 - asmdecl 1108 - assign 1109 - atomic 1110 - atomicalign 1111 - bools 1112 - buildtag 1113 - cgocall 1114 - composites 1115 - copylocks 1116 - deepequalerrors 1117 - defers 1118 - directive 1119 - errorsas 1120 - fieldalignment 1121 - findcall 1122 - framepointer 1123 - httpresponse 1124 - ifaceassert 1125 - loopclosure 1126 - lostcancel 1127 - nilfunc 1128 - nilness 1129 - printf 1130 - reflectvaluecompare 1131 - shadow 1132 - shift 1133 - sigchanyzer 1134 - slog 1135 - sortslice 1136 - stdmethods 1137 - stringintconv 1138 - structtag 1139 - testinggoroutine 1140 - tests 1141 - unmarshal 1142 - unreachable 1143 - unsafeptr 1144 - unusedresult 1145 - unusedwrite 1146 1147 # Enable all analyzers. 1148 # Default: false 1149 enable-all: true 1150 # Disable analyzers by name. 1151 # (in addition to default 1152 # atomicalign, deepequalerrors, fieldalignment, findcall, nilness, reflectvaluecompare, shadow, sortslice, 1153 # timeformat, unusedwrite 1154 # ). 1155 # Run `go tool vet help` to see all analyzers. 1156 # Default: [] 1157 disable: 1158 - appends 1159 - asmdecl 1160 - assign 1161 - atomic 1162 - atomicalign 1163 - bools 1164 - buildtag 1165 - cgocall 1166 - composites 1167 - copylocks 1168 - deepequalerrors 1169 - defers 1170 - directive 1171 - errorsas 1172 - fieldalignment 1173 - findcall 1174 - framepointer 1175 - httpresponse 1176 - ifaceassert 1177 - loopclosure 1178 - lostcancel 1179 - nilfunc 1180 - nilness 1181 - printf 1182 - reflectvaluecompare 1183 - shadow 1184 - shift 1185 - sigchanyzer 1186 - slog 1187 - sortslice 1188 - stdmethods 1189 - stringintconv 1190 - structtag 1191 - testinggoroutine 1192 - tests 1193 - unmarshal 1194 - unreachable 1195 - unsafeptr 1196 - unusedresult 1197 - unusedwrite 1198 1199 grouper: 1200 # Require the use of a single global 'const' declaration only. 1201 # Default: false 1202 const-require-single-const: true 1203 # Require the use of grouped global 'const' declarations. 1204 # Default: false 1205 const-require-grouping: true 1206 1207 # Require the use of a single 'import' declaration only. 1208 # Default: false 1209 import-require-single-import: true 1210 # Require the use of grouped 'import' declarations. 1211 # Default: false 1212 import-require-grouping: true 1213 1214 # Require the use of a single global 'type' declaration only. 1215 # Default: false 1216 type-require-single-type: true 1217 # Require the use of grouped global 'type' declarations. 1218 # Default: false 1219 type-require-grouping: true 1220 1221 # Require the use of a single global 'var' declaration only. 1222 # Default: false 1223 var-require-single-var: true 1224 # Require the use of grouped global 'var' declarations. 1225 # Default: false 1226 var-require-grouping: true 1227 1228 ifshort: 1229 # Maximum length of variable declaration measured in number of lines, after which linter won't suggest using short syntax. 1230 # Has higher priority than max-decl-chars. 1231 # Default: 1 1232 max-decl-lines: 2 1233 # Maximum length of variable declaration measured in number of characters, after which linter won't suggest using short syntax. 1234 # Default: 30 1235 max-decl-chars: 40 1236 1237 importas: 1238 # Do not allow unaliased imports of aliased packages. 1239 # Default: false 1240 no-unaliased: true 1241 # Do not allow non-required aliases. 1242 # Default: false 1243 no-extra-aliases: true 1244 # List of aliases 1245 # Default: [] 1246 alias: 1247 # Using `servingv1` alias for `knative.dev/serving/pkg/apis/serving/v1` package. 1248 - pkg: knative.dev/serving/pkg/apis/serving/v1 1249 alias: servingv1 1250 # Using `autoscalingv1alpha1` alias for `knative.dev/serving/pkg/apis/autoscaling/v1alpha1` package. 1251 - pkg: knative.dev/serving/pkg/apis/autoscaling/v1alpha1 1252 alias: autoscalingv1alpha1 1253 # You can specify the package path by regular expression, 1254 # and alias by regular expression expansion syntax like below. 1255 # see https://github.com/julz/importas#use-regular-expression for details 1256 - pkg: knative.dev/serving/pkg/apis/(\w+)/(v[\w\d]+) 1257 alias: $1$2 1258 1259 inamedparam: 1260 # Skips check for interface methods with only a single parameter. 1261 # Default: false 1262 skip-single-param: true 1263 1264 interfacebloat: 1265 # The maximum number of methods allowed for an interface. 1266 # Default: 10 1267 max: 5 1268 1269 ireturn: 1270 # ireturn does not allow using `allow` and `reject` settings at the same time. 1271 # Both settings are lists of the keywords and regular expressions matched to interface or package names. 1272 # keywords: 1273 # - `empty` for `interface{}` 1274 # - `error` for errors 1275 # - `stdlib` for standard library 1276 # - `anon` for anonymous interfaces 1277 # - `generic` for generic interfaces added in go 1.18 1278 1279 # By default, it allows using errors, empty interfaces, anonymous interfaces, 1280 # and interfaces provided by the standard library. 1281 allow: 1282 - anon 1283 - error 1284 - empty 1285 - stdlib 1286 # You can specify idiomatic endings for interface 1287 - (or|er)$ 1288 1289 # reject-list of interfaces 1290 reject: 1291 - github.com\/user\/package\/v4\.Type 1292 1293 lll: 1294 # Max line length, lines longer will be reported. 1295 # '\t' is counted as 1 character by default, and can be changed with the tab-width option. 1296 # Default: 120. 1297 line-length: 120 1298 # Tab width in spaces. 1299 # Default: 1 1300 tab-width: 1 1301 1302 loggercheck: 1303 # Allow check for the github.com/go-kit/log library. 1304 # Default: true 1305 kitlog: false 1306 # Allow check for the k8s.io/klog/v2 library. 1307 # Default: true 1308 klog: false 1309 # Allow check for the github.com/go-logr/logr library. 1310 # Default: true 1311 logr: false 1312 # Allow check for the "sugar logger" from go.uber.org/zap library. 1313 # Default: true 1314 zap: false 1315 # Require all logging keys to be inlined constant strings. 1316 # Default: false 1317 require-string-key: true 1318 # Require printf-like format specifier (%s, %d for example) not present. 1319 # Default: false 1320 no-printf-like: true 1321 # List of custom rules to check against, where each rule is a single logger pattern, useful for wrapped loggers. 1322 # For example: https://github.com/timonwong/loggercheck/blob/7395ab86595781e33f7afba27ad7b55e6956ebcd/testdata/custom-rules.txt 1323 # Default: empty 1324 rules: 1325 - k8s.io/klog/v2.InfoS # package level exported functions 1326 - (github.com/go-logr/logr.Logger).Error # "Methods" 1327 - (*go.uber.org/zap.SugaredLogger).With # Also "Methods", but with a pointer receiver 1328 1329 maintidx: 1330 # Show functions with maintainability index lower than N. 1331 # A high index indicates better maintainability (it's kind of the opposite of complexity). 1332 # Default: 20 1333 under: 100 1334 1335 makezero: 1336 # Allow only slices initialized with a length of zero. 1337 # Default: false 1338 always: true 1339 1340 maligned: 1341 # Print struct with more effective memory layout or not. 1342 # Default: false 1343 suggest-new: true 1344 1345 misspell: 1346 # Correct spellings using locale preferences for US or UK. 1347 # Setting locale to US will correct the British spelling of 'colour' to 'color'. 1348 # Default is to use a neutral variety of English. 1349 locale: US 1350 # Default: [] 1351 ignore-words: 1352 - someword 1353 # Mode of the analysis: 1354 # - default: checks all the file content. 1355 # - restricted: checks only comments. 1356 # Default: "" 1357 mode: restricted 1358 1359 musttag: 1360 # A set of custom functions to check in addition to the builtin ones. 1361 # Default: json, xml, gopkg.in/yaml.v3, BurntSushi/toml, mitchellh/mapstructure, jmoiron/sqlx 1362 functions: 1363 # The full name of the function, including the package. 1364 - name: github.com/hashicorp/hcl/v2/hclsimple.DecodeFile 1365 # The struct tag whose presence should be ensured. 1366 tag: hcl 1367 # The position of the argument to check. 1368 arg-pos: 2 1369 1370 nakedret: 1371 # Make an issue if func has more lines of code than this setting, and it has naked returns. 1372 # Default: 30 1373 max-func-lines: 31 1374 1375 nestif: 1376 # Minimal complexity of if statements to report. 1377 # Default: 5 1378 min-complexity: 4 1379 1380 nilnil: 1381 # Checks that there is no simultaneous return of `nil` error and an invalid value. 1382 # Default: ["ptr", "func", "iface", "map", "chan"] 1383 checked-types: 1384 - ptr 1385 - func 1386 - iface 1387 - map 1388 - chan 1389 1390 nlreturn: 1391 # Size of the block (including return statement that is still "OK") 1392 # so no return split required. 1393 # Default: 1 1394 block-size: 2 1395 1396 nolintlint: 1397 # Disable to ensure that all nolint directives actually have an effect. 1398 # Default: false 1399 allow-unused: true 1400 # Exclude following linters from requiring an explanation. 1401 # Default: [] 1402 allow-no-explanation: [ ] 1403 # Enable to require an explanation of nonzero length after each nolint directive. 1404 # Default: false 1405 require-explanation: true 1406 # Enable to require nolint directives to mention the specific linter being suppressed. 1407 # Default: false 1408 require-specific: true 1409 1410 nonamedreturns: 1411 # Report named error if it is assigned inside defer. 1412 # Default: false 1413 report-error-in-defer: true 1414 1415 nxboundary: 1416 # Maps NX project tags to a list tags each project is allowed to import from. The list of tags is a comma-separated list of tags. 1417 # Default: {} 1418 allowed-tags: 1419 scope:tag: 1420 - scope:othertag 1421 1422 paralleltest: 1423 # Ignore missing calls to `t.Parallel()` and only report incorrect uses of it. 1424 # Default: false 1425 ignore-missing: true 1426 # Ignore missing calls to `t.Parallel()` in subtests. Top-level tests are 1427 # still required to have `t.Parallel`, but subtests are allowed to skip it. 1428 # Default: false 1429 ignore-missing-subtests: true 1430 1431 perfsprint: 1432 # Optimizes even if it requires an int or uint type cast. 1433 # Default: true 1434 int-conversion: false 1435 # Optimizes into `err.Error()` even if it is only equivalent for non-nil errors. 1436 # Default: false 1437 err-error: true 1438 # Optimizes `fmt.Errorf`. 1439 # Default: true 1440 errorf: false 1441 # Optimizes `fmt.Sprintf` with only one argument 1442 # Default: true 1443 sprintf1: false 1444 1445 prealloc: 1446 # IMPORTANT: we don't recommend using this linter before doing performance profiling. 1447 # For most programs usage of prealloc will be a premature optimization. 1448 1449 # Report pre-allocation suggestions only on simple loops that have no returns/breaks/continues/gotos in them. 1450 # Default: true 1451 simple: false 1452 # Report pre-allocation suggestions on range loops. 1453 # Default: true 1454 range-loops: false 1455 # Report pre-allocation suggestions on for loops. 1456 # Default: false 1457 for-loops: true 1458 1459 predeclared: 1460 # Comma-separated list of predeclared identifiers to not report on. 1461 # Default: "" 1462 ignore: "new,int" 1463 # Include method names and field names (i.e., qualified names) in checks. 1464 # Default: false 1465 q: true 1466 1467 promlinter: 1468 # Promlinter cannot infer all metrics name in static analysis. 1469 # Enable strict mode will also include the errors caused by failing to parse the args. 1470 # Default: false 1471 strict: true 1472 # Please refer to https://github.com/yeya24/promlinter#usage for detailed usage. 1473 # Default: [] 1474 disabled-linters: 1475 - Help 1476 - MetricUnits 1477 - Counter 1478 - HistogramSummaryReserved 1479 - MetricTypeInName 1480 - ReservedChars 1481 - CamelCase 1482 - UnitAbbreviations 1483 1484 protogetter: 1485 # Skip files generated by specified generators from the checking. 1486 # Checks only the file's initial comment, which must follow the format: "// Code generated by <generator-name>". 1487 # Files generated by protoc-gen-go, protoc-gen-go-grpc, and protoc-gen-grpc-gateway are always excluded automatically. 1488 # Default: [] 1489 skip-generated-by: ["protoc-gen-go-my-own-generator"] 1490 # Skip files matching the specified glob pattern from the checking. 1491 # Default: [] 1492 skip-files: 1493 - "*.pb.go" 1494 - "*/vendor/*" 1495 - "/full/path/to/file.go" 1496 # Skip any generated files from the checking. 1497 # Default: false 1498 skip-any-generated: true 1499 # Skip first argument of append function. 1500 # Default: false 1501 replace-first-arg-in-append: true 1502 1503 reassign: 1504 # Patterns for global variable names that are checked for reassignment. 1505 # See https://github.com/curioswitch/go-reassign#usage 1506 # Default: ["EOF", "Err.*"] 1507 patterns: 1508 - ".*" 1509 1510 revive: 1511 # Maximum number of open files at the same time. 1512 # See https://github.com/mgechev/revive#command-line-flags 1513 # Defaults to unlimited. 1514 max-open-files: 2048 1515 1516 # When set to false, ignores files with "GENERATED" header, similar to golint. 1517 # See https://github.com/mgechev/revive#available-rules for details. 1518 # Default: false 1519 ignore-generated-header: true 1520 1521 # Sets the default severity. 1522 # See https://github.com/mgechev/revive#configuration 1523 # Default: warning 1524 severity: error 1525 1526 # Enable all available rules. 1527 # Default: false 1528 enable-all-rules: true 1529 1530 # Sets the default failure confidence. 1531 # This means that linting errors with less than 0.8 confidence will be ignored. 1532 # Default: 0.8 1533 confidence: 0.1 1534 1535 rules: 1536 # https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#add-constant 1537 - name: add-constant 1538 severity: warning 1539 disabled: false 1540 arguments: 1541 - maxLitCount: "3" 1542 allowStrs: '""' 1543 allowInts: "0,1,2" 1544 allowFloats: "0.0,0.,1.0,1.,2.0,2." 1545 # https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#argument-limit 1546 - name: argument-limit 1547 severity: warning 1548 disabled: false 1549 arguments: [ 4 ] 1550 # https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#atomic 1551 - name: atomic 1552 severity: warning 1553 disabled: false 1554 # https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#banned-characters 1555 - name: banned-characters 1556 severity: warning 1557 disabled: false 1558 arguments: [ "Ω","Σ","σ", "7" ] 1559 # https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#bare-return 1560 - name: bare-return 1561 severity: warning 1562 disabled: false 1563 # https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#blank-imports 1564 - name: blank-imports 1565 severity: warning 1566 disabled: false 1567 # https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#bool-literal-in-expr 1568 - name: bool-literal-in-expr 1569 severity: warning 1570 disabled: false 1571 # https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#call-to-gc 1572 - name: call-to-gc 1573 severity: warning 1574 disabled: false 1575 # https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#cognitive-complexity 1576 - name: cognitive-complexity 1577 severity: warning 1578 disabled: false 1579 arguments: [ 7 ] 1580 # https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#comment-spacings 1581 - name: comment-spacings 1582 severity: warning 1583 disabled: false 1584 arguments: 1585 - mypragma 1586 - otherpragma 1587 # https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#confusing-naming 1588 - name: confusing-naming 1589 severity: warning 1590 disabled: false 1591 # https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#confusing-results 1592 - name: confusing-results 1593 severity: warning 1594 disabled: false 1595 # https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#constant-logical-expr 1596 - name: constant-logical-expr 1597 severity: warning 1598 disabled: false 1599 # https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#context-as-argument 1600 - name: context-as-argument 1601 severity: warning 1602 disabled: false 1603 arguments: 1604 - allowTypesBefore: "*testing.T,*github.com/user/repo/testing.Harness" 1605 # https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#context-keys-type 1606 - name: context-keys-type 1607 severity: warning 1608 disabled: false 1609 # https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#cyclomatic 1610 - name: cyclomatic 1611 severity: warning 1612 disabled: false 1613 arguments: [ 3 ] 1614 # https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#datarace 1615 - name: datarace 1616 severity: warning 1617 disabled: false 1618 # https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#deep-exit 1619 - name: deep-exit 1620 severity: warning 1621 disabled: false 1622 # https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#defer 1623 - name: defer 1624 severity: warning 1625 disabled: false 1626 arguments: 1627 - [ "call-chain", "loop" ] 1628 # https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#dot-imports 1629 - name: dot-imports 1630 severity: warning 1631 disabled: false 1632 # https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#duplicated-imports 1633 - name: duplicated-imports 1634 severity: warning 1635 disabled: false 1636 # https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#early-return 1637 - name: early-return 1638 severity: warning 1639 disabled: false 1640 arguments: 1641 - "preserveScope" 1642 # https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#empty-block 1643 - name: empty-block 1644 severity: warning 1645 disabled: false 1646 # https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#empty-lines 1647 - name: empty-lines 1648 severity: warning 1649 disabled: false 1650 # https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#enforce-map-style 1651 - name: enforce-map-style 1652 severity: warning 1653 disabled: false 1654 arguments: 1655 - "make" 1656 # https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#enforce-repeated-arg-type-style 1657 - name: enforce-repeated-arg-type-style 1658 severity: warning 1659 disabled: false 1660 arguments: 1661 - "short" 1662 # https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#enforce-slice-style 1663 - name: enforce-slice-style 1664 severity: warning 1665 disabled: false 1666 arguments: 1667 - "make" 1668 # https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#error-naming 1669 - name: error-naming 1670 severity: warning 1671 disabled: false 1672 # https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#error-return 1673 - name: error-return 1674 severity: warning 1675 disabled: false 1676 # https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#error-strings 1677 - name: error-strings 1678 severity: warning 1679 disabled: false 1680 # https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#errorf 1681 - name: errorf 1682 severity: warning 1683 disabled: false 1684 # https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#exported 1685 - name: exported 1686 severity: warning 1687 disabled: false 1688 arguments: 1689 - "preserveScope" 1690 - "checkPrivateReceivers" 1691 - "sayRepetitiveInsteadOfStutters" 1692 # https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#file-header 1693 - name: file-header 1694 severity: warning 1695 disabled: false 1696 arguments: 1697 - This is the text that must appear at the top of source files. 1698 # https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#flag-parameter 1699 - name: flag-parameter 1700 severity: warning 1701 disabled: false 1702 # https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#function-result-limit 1703 - name: function-result-limit 1704 severity: warning 1705 disabled: false 1706 arguments: [ 2 ] 1707 # https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#function-length 1708 - name: function-length 1709 severity: warning 1710 disabled: false 1711 arguments: [ 10, 0 ] 1712 # https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#get-return 1713 - name: get-return 1714 severity: warning 1715 disabled: false 1716 # https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#identical-branches 1717 - name: identical-branches 1718 severity: warning 1719 disabled: false 1720 # https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#if-return 1721 - name: if-return 1722 severity: warning 1723 disabled: false 1724 # https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#increment-decrement 1725 - name: increment-decrement 1726 severity: warning 1727 disabled: false 1728 # https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#indent-error-flow 1729 - name: indent-error-flow 1730 severity: warning 1731 disabled: false 1732 arguments: 1733 - "preserveScope" 1734 # https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#import-alias-naming 1735 - name: import-alias-naming 1736 severity: warning 1737 disabled: false 1738 arguments: 1739 - "^[a-z][a-z0-9]{0,}$" 1740 # https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#imports-blacklist 1741 - name: imports-blacklist 1742 severity: warning 1743 disabled: false 1744 arguments: 1745 - "crypto/md5" 1746 - "crypto/sha1" 1747 # https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#import-shadowing 1748 - name: import-shadowing 1749 severity: warning 1750 disabled: false 1751 # https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#line-length-limit 1752 - name: line-length-limit 1753 severity: warning 1754 disabled: false 1755 arguments: [ 80 ] 1756 # https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#max-public-structs 1757 - name: max-public-structs 1758 severity: warning 1759 disabled: false 1760 arguments: [ 3 ] 1761 # https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#modifies-parameter 1762 - name: modifies-parameter 1763 severity: warning 1764 disabled: false 1765 # https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#modifies-value-receiver 1766 - name: modifies-value-receiver 1767 severity: warning 1768 disabled: false 1769 # https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#nested-structs 1770 - name: nested-structs 1771 severity: warning 1772 disabled: false 1773 # https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#optimize-operands-order 1774 - name: optimize-operands-order 1775 severity: warning 1776 disabled: false 1777 # https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#package-comments 1778 - name: package-comments 1779 severity: warning 1780 disabled: false 1781 # https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#range 1782 - name: range 1783 severity: warning 1784 disabled: false 1785 # https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#range-val-in-closure 1786 - name: range-val-in-closure 1787 severity: warning 1788 disabled: false 1789 # https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#range-val-address 1790 - name: range-val-address 1791 severity: warning 1792 disabled: false 1793 # https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#receiver-naming 1794 - name: receiver-naming 1795 severity: warning 1796 disabled: false 1797 # https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#redundant-import-alias 1798 - name: redundant-import-alias 1799 severity: warning 1800 disabled: false 1801 # https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#redefines-builtin-id 1802 - name: redefines-builtin-id 1803 severity: warning 1804 disabled: false 1805 # https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#string-of-int 1806 - name: string-of-int 1807 severity: warning 1808 disabled: false 1809 # https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#string-format 1810 - name: string-format 1811 severity: warning 1812 disabled: false 1813 arguments: 1814 - - 'core.WriteError[1].Message' 1815 - '/^([^A-Z]|$)/' 1816 - must not start with a capital letter 1817 - - 'fmt.Errorf[0]' 1818 - '/(^|[^\.!?])$/' 1819 - must not end in punctuation 1820 - - panic 1821 - '/^[^\n]*$/' 1822 - must not contain line breaks 1823 # https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#struct-tag 1824 - name: struct-tag 1825 arguments: 1826 - "json,inline" 1827 - "bson,outline,gnu" 1828 severity: warning 1829 disabled: false 1830 # https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#superfluous-else 1831 - name: superfluous-else 1832 severity: warning 1833 disabled: false 1834 arguments: 1835 - "preserveScope" 1836 # https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#time-equal 1837 - name: time-equal 1838 severity: warning 1839 disabled: false 1840 # https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#time-naming 1841 - name: time-naming 1842 severity: warning 1843 disabled: false 1844 # https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#var-naming 1845 - name: var-naming 1846 severity: warning 1847 disabled: false 1848 arguments: 1849 - [ "ID" ] # AllowList 1850 - [ "VM" ] # DenyList 1851 - - upperCaseConst: true 1852 # https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#var-declaration 1853 - name: var-declaration 1854 severity: warning 1855 disabled: false 1856 # https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#unconditional-recursion 1857 - name: unconditional-recursion 1858 severity: warning 1859 disabled: false 1860 # https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#unexported-naming 1861 - name: unexported-naming 1862 severity: warning 1863 disabled: false 1864 # https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#unexported-return 1865 - name: unexported-return 1866 severity: warning 1867 disabled: false 1868 # https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#unhandled-error 1869 - name: unhandled-error 1870 severity: warning 1871 disabled: false 1872 arguments: 1873 - "fmt.Printf" 1874 - "myFunction" 1875 # https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#unnecessary-stmt 1876 - name: unnecessary-stmt 1877 severity: warning 1878 disabled: false 1879 # https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#unreachable-code 1880 - name: unreachable-code 1881 severity: warning 1882 disabled: false 1883 # https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#unused-parameter 1884 - name: unused-parameter 1885 severity: warning 1886 disabled: false 1887 arguments: 1888 - allowRegex: "^_" 1889 # https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#unused-receiver 1890 - name: unused-receiver 1891 severity: warning 1892 disabled: false 1893 arguments: 1894 - allowRegex: "^_" 1895 # https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#useless-break 1896 - name: useless-break 1897 severity: warning 1898 disabled: false 1899 # https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#waitgroup-by-value 1900 - name: waitgroup-by-value 1901 severity: warning 1902 disabled: false 1903 1904 rowserrcheck: 1905 # database/sql is always checked 1906 # Default: [] 1907 packages: 1908 - github.com/jmoiron/sqlx 1909 1910 sloglint: 1911 # Enforce not mixing key-value pairs and attributes. 1912 # Default: true 1913 no-mixed-args: false 1914 # Enforce using key-value pairs only (overrides no-mixed-args, incompatible with attr-only). 1915 # Default: false 1916 kv-only: true 1917 # Enforce using attributes only (overrides no-mixed-args, incompatible with kv-only). 1918 # Default: false 1919 attr-only: true 1920 # Enforce using methods that accept a context. 1921 # Default: false 1922 context-only: true 1923 # Enforce using static values for log messages. 1924 # Default: false 1925 static-msg: true 1926 # Enforce using constants instead of raw keys. 1927 # Default: false 1928 no-raw-keys: true 1929 # Enforce a single key naming convention. 1930 # Values: snake, kebab, camel, pascal 1931 # Default: "" 1932 key-naming-case: snake 1933 # Enforce putting arguments on separate lines. 1934 # Default: false 1935 args-on-sep-lines: true 1936 1937 spancheck: 1938 # Checks to enable. 1939 # Options include: 1940 # - `end`: check that `span.End()` is called 1941 # - `record-error`: check that `span.RecordError(err)` is called when an error is returned 1942 # - `set-status`: check that `span.SetStatus(codes.Error, msg)` is called when an error is returned 1943 # Default: ["end"] 1944 checks: 1945 - end 1946 - record-error 1947 - set-status 1948 # A list of regexes for function signatures that silence `record-error` and `set-status` reports 1949 # if found in the call path to a returned error. 1950 # https://github.com/jjti/go-spancheck#ignore-check-signatures 1951 # Default: [] 1952 ignore-check-signatures: 1953 - "telemetry.RecordError" 1954 1955 staticcheck: 1956 # Deprecated: use the global `run.go` instead. 1957 go: "1.15" 1958 # SAxxxx checks in https://staticcheck.io/docs/configuration/options/#checks 1959 # Default: ["*"] 1960 checks: [ "all" ] 1961 1962 stylecheck: 1963 # Deprecated: use the global `run.go` instead. 1964 go: "1.15" 1965 # STxxxx checks in https://staticcheck.io/docs/configuration/options/#checks 1966 # Default: ["*"] 1967 checks: [ "all", "-ST1000", "-ST1003", "-ST1016", "-ST1020", "-ST1021", "-ST1022" ] 1968 # https://staticcheck.io/docs/configuration/options/#dot_import_whitelist 1969 # Default: ["github.com/mmcloughlin/avo/build", "github.com/mmcloughlin/avo/operand", "github.com/mmcloughlin/avo/reg"] 1970 dot-import-whitelist: 1971 - fmt 1972 # https://staticcheck.io/docs/configuration/options/#initialisms 1973 # Default: ["ACL", "API", "ASCII", "CPU", "CSS", "DNS", "EOF", "GUID", "HTML", "HTTP", "HTTPS", "ID", "IP", "JSON", "QPS", "RAM", "RPC", "SLA", "SMTP", "SQL", "SSH", "TCP", "TLS", "TTL", "UDP", "UI", "GID", "UID", "UUID", "URI", "URL", "UTF8", "VM", "XML", "XMPP", "XSRF", "XSS", "SIP", "RTP", "AMQP", "DB", "TS"] 1974 initialisms: [ "ACL", "API", "ASCII", "CPU", "CSS", "DNS", "EOF", "GUID", "HTML", "HTTP", "HTTPS", "ID", "IP", "JSON", "QPS", "RAM", "RPC", "SLA", "SMTP", "SQL", "SSH", "TCP", "TLS", "TTL", "UDP", "UI", "GID", "UID", "UUID", "URI", "URL", "UTF8", "VM", "XML", "XMPP", "XSRF", "XSS", "SIP", "RTP", "AMQP", "DB", "TS" ] 1975 # https://staticcheck.io/docs/configuration/options/#http_status_code_whitelist 1976 # Default: ["200", "400", "404", "500"] 1977 http-status-code-whitelist: [ "200", "400", "404", "500" ] 1978 1979 tagalign: 1980 # Align and sort can be used together or separately. 1981 # 1982 # Whether enable align. If true, the struct tags will be aligned. 1983 # eg: 1984 # type FooBar struct { 1985 # Bar string `json:"bar" validate:"required"` 1986 # FooFoo int8 `json:"foo_foo" validate:"required"` 1987 # } 1988 # will be formatted to: 1989 # type FooBar struct { 1990 # Bar string `json:"bar" validate:"required"` 1991 # FooFoo int8 `json:"foo_foo" validate:"required"` 1992 # } 1993 # Default: true. 1994 align: false 1995 # Whether enable tags sort. 1996 # If true, the tags will be sorted by name in ascending order. 1997 # eg: `xml:"bar" json:"bar" validate:"required"` -> `json:"bar" validate:"required" xml:"bar"` 1998 # Default: true 1999 sort: false 2000 # Specify the order of tags, the other tags will be sorted by name. 2001 # This option will be ignored if `sort` is false. 2002 # Default: [] 2003 order: 2004 - json 2005 - yaml 2006 - yml 2007 - toml 2008 - mapstructure 2009 - binding 2010 - validate 2011 # Whether enable strict style. 2012 # In this style, the tags will be sorted and aligned in the dictionary order, 2013 # and the tags with the same name will be aligned together. 2014 # Note: This option will be ignored if 'align' or 'sort' is false. 2015 # Default: false 2016 strict: true 2017 2018 tagliatelle: 2019 # Check the struct tag name case. 2020 case: 2021 # Use the struct field name to check the name of the struct tag. 2022 # Default: false 2023 use-field-name: true 2024 # `camel` is used for `json` and `yaml`, and `header` is used for `header` (can be overridden) 2025 # Default: {} 2026 rules: 2027 # Any struct tag type can be used. 2028 # Support string case: `camel`, `pascal`, `kebab`, `snake`, `upperSnake`, `goCamel`, `goPascal`, `goKebab`, `goSnake`, `upper`, `lower`, `header` 2029 json: camel 2030 yaml: camel 2031 xml: camel 2032 bson: camel 2033 avro: snake 2034 mapstructure: kebab 2035 env: upperSnake 2036 envconfig: upperSnake 2037 2038 tenv: 2039 # The option `all` will run against whole test files (`_test.go`) regardless of method/function signatures. 2040 # Otherwise, only methods that take `*testing.T`, `*testing.B`, and `testing.TB` as arguments are checked. 2041 # Default: false 2042 all: false 2043 2044 testifylint: 2045 # Enable all checkers (https://github.com/Antonboom/testifylint#checkers). 2046 # Default: false 2047 enable-all: true 2048 # Disable checkers by name 2049 # (in addition to default 2050 # suite-thelper 2051 # ). 2052 disable: 2053 - blank-import 2054 - bool-compare 2055 - compares 2056 - empty 2057 - error-is-as 2058 - error-nil 2059 - expected-actual 2060 - go-require 2061 - float-compare 2062 - len 2063 - nil-compare 2064 - require-error 2065 - suite-dont-use-pkg 2066 - suite-extra-assert-call 2067 - suite-thelper 2068 - useless-assert 2069 2070 # Disable all checkers (https://github.com/Antonboom/testifylint#checkers). 2071 # Default: false 2072 disable-all: true 2073 # Enable checkers by name 2074 # (in addition to default 2075 # blank-import, bool-compare, compares, empty, error-is-as, error-nil, expected-actual, go-require, float-compare, 2076 # len, nil-compare, require-error, suite-dont-use-pkg, suite-extra-assert-call, useless-assert 2077 # ). 2078 enable: 2079 - blank-import 2080 - bool-compare 2081 - compares 2082 - empty 2083 - error-is-as 2084 - error-nil 2085 - expected-actual 2086 - go-require 2087 - float-compare 2088 - len 2089 - nil-compare 2090 - require-error 2091 - suite-dont-use-pkg 2092 - suite-extra-assert-call 2093 - suite-thelper 2094 - useless-assert 2095 2096 expected-actual: 2097 # Regexp for expected variable name. 2098 # Default: (^(exp(ected)?|want(ed)?)([A-Z]\w*)?$)|(^(\w*[a-z])?(Exp(ected)?|Want(ed)?)$) 2099 pattern: ^expected 2100 require-error: 2101 # Regexp for assertions to analyze. If defined, then only matched error assertions will be reported. 2102 # Default: "" 2103 fn-pattern: ^(Errorf?|NoErrorf?)$ 2104 suite-extra-assert-call: 2105 # To require or remove extra Assert() call? 2106 # Default: remove 2107 mode: require 2108 2109 testpackage: 2110 # Regexp pattern to skip files. 2111 # Default: "(export|internal)_test\\.go" 2112 skip-regexp: (export|internal)_test\.go 2113 # List of packages that don't end with _test that tests are allowed to be in. 2114 # Default: "main" 2115 allow-packages: 2116 - example 2117 - main 2118 2119 thelper: 2120 test: 2121 # Check *testing.T is first param (or after context.Context) of helper function. 2122 # Default: true 2123 first: false 2124 # Check *testing.T param has name t. 2125 # Default: true 2126 name: false 2127 # Check t.Helper() begins helper function. 2128 # Default: true 2129 begin: false 2130 benchmark: 2131 # Check *testing.B is first param (or after context.Context) of helper function. 2132 # Default: true 2133 first: false 2134 # Check *testing.B param has name b. 2135 # Default: true 2136 name: false 2137 # Check b.Helper() begins helper function. 2138 # Default: true 2139 begin: false 2140 tb: 2141 # Check *testing.TB is first param (or after context.Context) of helper function. 2142 # Default: true 2143 first: false 2144 # Check *testing.TB param has name tb. 2145 # Default: true 2146 name: false 2147 # Check tb.Helper() begins helper function. 2148 # Default: true 2149 begin: false 2150 fuzz: 2151 # Check *testing.F is first param (or after context.Context) of helper function. 2152 # Default: true 2153 first: false 2154 # Check *testing.F param has name f. 2155 # Default: true 2156 name: false 2157 # Check f.Helper() begins helper function. 2158 # Default: true 2159 begin: false 2160 2161 usestdlibvars: 2162 # Suggest the use of http.MethodXX. 2163 # Default: true 2164 http-method: false 2165 # Suggest the use of http.StatusXX. 2166 # Default: true 2167 http-status-code: false 2168 # Suggest the use of time.Weekday.String(). 2169 # Default: true 2170 time-weekday: true 2171 # Suggest the use of time.Month.String(). 2172 # Default: false 2173 time-month: true 2174 # Suggest the use of time.Layout. 2175 # Default: false 2176 time-layout: true 2177 # Suggest the use of crypto.Hash.String(). 2178 # Default: false 2179 crypto-hash: true 2180 # Suggest the use of rpc.DefaultXXPath. 2181 # Default: false 2182 default-rpc-path: true 2183 # DEPRECATED Suggest the use of os.DevNull. 2184 # Default: false 2185 os-dev-null: true 2186 # Suggest the use of sql.LevelXX.String(). 2187 # Default: false 2188 sql-isolation-level: true 2189 # Suggest the use of tls.SignatureScheme.String(). 2190 # Default: false 2191 tls-signature-scheme: true 2192 # Suggest the use of constant.Kind.String(). 2193 # Default: false 2194 constant-kind: true 2195 # DEPRECATED Suggest the use of syslog.Priority. 2196 # Default: false 2197 syslog-priority: true 2198 2199 unparam: 2200 # Inspect exported functions. 2201 # 2202 # Set to true if no external program/library imports your code. 2203 # XXX: if you enable this setting, unparam will report a lot of false-positives in text editors: 2204 # if it's called for subdir of a project it can't find external interfaces. All text editor integrations 2205 # with golangci-lint call it on a directory with the changed file. 2206 # 2207 # Default: false 2208 check-exported: true 2209 2210 unused: 2211 # Mark all struct fields that have been written to as used. 2212 # Default: true 2213 field-writes-are-uses: false 2214 # Treat IncDec statement (e.g. `i++` or `i--`) as both read and write operation instead of just write. 2215 # Default: false 2216 post-statements-are-reads: true 2217 # Mark all exported identifiers as used. 2218 # Default: true 2219 exported-is-used: false 2220 # Mark all exported fields as used. 2221 # default: true 2222 exported-fields-are-used: false 2223 # Mark all function parameters as used. 2224 # default: true 2225 parameters-are-used: false 2226 # Mark all local variables as used. 2227 # default: true 2228 local-variables-are-used: false 2229 # Mark all identifiers inside generated files as used. 2230 # Default: true 2231 generated-is-used: false 2232 2233 varcheck: 2234 # Check usage of exported fields and variables. 2235 # Default: false 2236 exported-fields: true 2237 2238 varnamelen: 2239 # The longest distance, in source lines, that is being considered a "small scope". 2240 # Variables used in at most this many lines will be ignored. 2241 # Default: 5 2242 max-distance: 6 2243 # The minimum length of a variable's name that is considered "long". 2244 # Variable names that are at least this long will be ignored. 2245 # Default: 3 2246 min-name-length: 2 2247 # Check method receivers. 2248 # Default: false 2249 check-receiver: true 2250 # Check named return values. 2251 # Default: false 2252 check-return: true 2253 # Check type parameters. 2254 # Default: false 2255 check-type-param: true 2256 # Ignore "ok" variables that hold the bool return value of a type assertion. 2257 # Default: false 2258 ignore-type-assert-ok: true 2259 # Ignore "ok" variables that hold the bool return value of a map index. 2260 # Default: false 2261 ignore-map-index-ok: true 2262 # Ignore "ok" variables that hold the bool return value of a channel receive. 2263 # Default: false 2264 ignore-chan-recv-ok: true 2265 # Optional list of variable names that should be ignored completely. 2266 # Default: [] 2267 ignore-names: 2268 - err 2269 # Optional list of variable declarations that should be ignored completely. 2270 # Entries must be in one of the following forms (see below for examples): 2271 # - for variables, parameters, named return values, method receivers, or type parameters: 2272 # <name> <type> (<type> can also be a pointer/slice/map/chan/...) 2273 # - for constants: const <name> 2274 # 2275 # Default: [] 2276 ignore-decls: 2277 - c echo.Context 2278 - t testing.T 2279 - f *foo.Bar 2280 - e error 2281 - i int 2282 - const C 2283 - T any 2284 - m map[string]int 2285 2286 whitespace: 2287 # Enforces newlines (or comments) after every multi-line if statement. 2288 # Default: false 2289 multi-if: true 2290 # Enforces newlines (or comments) after every multi-line function signature. 2291 # Default: false 2292 multi-func: true 2293 2294 wrapcheck: 2295 # An array of strings that specify substrings of signatures to ignore. 2296 # If this set, it will override the default set of ignored signatures. 2297 # See https://github.com/tomarrell/wrapcheck#configuration for more information. 2298 # Default: [".Errorf(", "errors.New(", "errors.Unwrap(", "errors.Join(", ".Wrap(", ".Wrapf(", ".WithMessage(", ".WithMessagef(", ".WithStack("] 2299 ignoreSigs: 2300 - .Errorf( 2301 - errors.New( 2302 - errors.Unwrap( 2303 - errors.Join( 2304 - .Wrap( 2305 - .Wrapf( 2306 - .WithMessage( 2307 - .WithMessagef( 2308 - .WithStack( 2309 # An array of strings that specify regular expressions of signatures to ignore. 2310 # Default: [] 2311 ignoreSigRegexps: 2312 - \.New.*Error\( 2313 # An array of strings that specify globs of packages to ignore. 2314 # Default: [] 2315 ignorePackageGlobs: 2316 - encoding/* 2317 - github.com/pkg/* 2318 # An array of strings that specify regular expressions of interfaces to ignore. 2319 # Default: [] 2320 ignoreInterfaceRegexps: 2321 - ^(?i)c(?-i)ach(ing|e) 2322 2323 wsl: 2324 # See https://github.com/bombsimon/wsl/blob/master/doc/configuration.md for documentation of available settings. 2325 # These are the defaults for `golangci-lint`. 2326 2327 # Do strict checking when assigning from append (x = append(x, y)). If 2328 # this is set to true - the append call must append either a variable 2329 # assigned, called or used on the line above. 2330 strict-append: true 2331 2332 # Allows assignments to be cuddled with variables used in calls on 2333 # line above and calls to be cuddled with assignments of variables 2334 # used in call on line above. 2335 allow-assign-and-call: true 2336 2337 # Allows assignments to be cuddled with anything. 2338 allow-assign-and-anything: false 2339 2340 # Allows cuddling to assignments even if they span over multiple lines. 2341 allow-multiline-assign: true 2342 2343 # If the number of lines in a case block is equal to or lager than this 2344 # number, the case *must* end white a newline. 2345 force-case-trailing-whitespace: 0 2346 2347 # Allow blocks to end with comments. 2348 allow-trailing-comment: false 2349 2350 # Allow multiple comments in the beginning of a block separated with newline. 2351 allow-separated-leading-comment: false 2352 2353 # Allow multiple var/declaration statements to be cuddled. 2354 allow-cuddle-declarations: false 2355 2356 # A list of call idents that everything can be cuddled with. 2357 # Defaults to calls looking like locks. 2358 allow-cuddle-with-calls: [ "Lock", "RLock" ] 2359 2360 # AllowCuddleWithRHS is a list of right hand side variables that is allowed 2361 # to be cuddled with anything. Defaults to assignments or calls looking 2362 # like unlocks. 2363 allow-cuddle-with-rhs: [ "Unlock", "RUnlock" ] 2364 2365 # Causes an error when an If statement that checks an error variable doesn't 2366 # cuddle with the assignment of that variable. 2367 force-err-cuddling: false 2368 2369 # When force-err-cuddling is enabled this is a list of names 2370 # used for error variables to check for in the conditional. 2371 error-variable-names: [ "err" ] 2372 2373 # Causes an error if a short declaration (:=) cuddles with anything other than 2374 # another short declaration. 2375 # This logic overrides force-err-cuddling among others. 2376 force-short-decl-cuddling: false 2377 2378 # The custom section can be used to define linter plugins to be loaded at runtime. 2379 # See README documentation for more info. 2380 custom: 2381 # Each custom linter should have a unique name. 2382 example: 2383 # The path to the plugin *.so. Can be absolute or local. 2384 # Required for each custom linter. 2385 path: /path/to/example.so 2386 # The description of the linter. 2387 # Optional. 2388 description: This is an example usage of a plugin linter. 2389 # Intended to point to the repo location of the linter. 2390 # Optional. 2391 original-url: github.com/golangci/example-linter 2392 2393 2394 linters: 2395 # Disable all linters. 2396 # Default: false 2397 disable-all: true 2398 # Enable specific linter 2399 # https://golangci-lint.run/usage/linters/#enabled-by-default 2400 enable: 2401 - asasalint 2402 - asciicheck 2403 - bidichk 2404 - bodyclose 2405 - containedctx 2406 - contextcheck 2407 - cyclop 2408 - deadcode 2409 - decorder 2410 - depguard 2411 - dogsled 2412 - dupl 2413 - dupword 2414 - durationcheck 2415 - errcheck 2416 - errchkjson 2417 - errname 2418 - errorlint 2419 - execinquery 2420 - exhaustive 2421 - exhaustivestruct 2422 - exhaustruct 2423 - exportloopref 2424 - forbidigo 2425 - forcetypeassert 2426 - funlen 2427 - gci 2428 - ginkgolinter 2429 - gocheckcompilerdirectives 2430 - gochecknoglobals 2431 - gochecknoinits 2432 - gochecksumtype 2433 - gocognit 2434 - goconst 2435 - gocritic 2436 - gocyclo 2437 - godot 2438 - godox 2439 - goerr113 2440 - gofmt 2441 - gofumpt 2442 - goheader 2443 - goimports 2444 - golint 2445 - gomnd 2446 - gomoddirectives 2447 - gomodguard 2448 - goprintffuncname 2449 - gosec 2450 - gosimple 2451 - gosmopolitan 2452 - govet 2453 - grouper 2454 - ifshort 2455 - importas 2456 - inamedparam 2457 - ineffassign 2458 - interfacebloat 2459 - interfacer 2460 - ireturn 2461 - lll 2462 - loggercheck 2463 - maintidx 2464 - makezero 2465 - maligned 2466 - mirror 2467 - misspell 2468 - musttag 2469 - nakedret 2470 - nestif 2471 - nilerr 2472 - nilnil 2473 - nlreturn 2474 - noctx 2475 - nolintlint 2476 - nonamedreturns 2477 - nosnakecase 2478 - nosprintfhostport 2479 - paralleltest 2480 - perfsprint 2481 - prealloc 2482 - predeclared 2483 - promlinter 2484 - protogetter 2485 - reassign 2486 - revive 2487 - rowserrcheck 2488 - scopelint 2489 - sloglint 2490 - spancheck 2491 - sqlclosecheck 2492 - staticcheck 2493 - structcheck 2494 - stylecheck 2495 - tagalign 2496 - tagliatelle 2497 - tenv 2498 - testableexamples 2499 - testifylint 2500 - testpackage 2501 - thelper 2502 - tparallel 2503 - typecheck 2504 - unconvert 2505 - unparam 2506 - unused 2507 - usestdlibvars 2508 - varcheck 2509 - varnamelen 2510 - wastedassign 2511 - whitespace 2512 - wrapcheck 2513 - wsl 2514 - zerologlint 2515 2516 # Enable all available linters. 2517 # Default: false 2518 enable-all: true 2519 # Disable specific linter 2520 # https://golangci-lint.run/usage/linters/#disabled-by-default 2521 disable: 2522 - asasalint 2523 - asciicheck 2524 - bidichk 2525 - bodyclose 2526 - containedctx 2527 - contextcheck 2528 - cyclop 2529 - deadcode 2530 - decorder 2531 - depguard 2532 - dogsled 2533 - dupl 2534 - dupword 2535 - durationcheck 2536 - errcheck 2537 - errchkjson 2538 - errname 2539 - errorlint 2540 - execinquery 2541 - exhaustive 2542 - exhaustivestruct 2543 - exhaustruct 2544 - exportloopref 2545 - forbidigo 2546 - forcetypeassert 2547 - funlen 2548 - gci 2549 - ginkgolinter 2550 - gocheckcompilerdirectives 2551 - gochecknoglobals 2552 - gochecknoinits 2553 - gochecksumtype 2554 - gocognit 2555 - goconst 2556 - gocritic 2557 - gocyclo 2558 - godot 2559 - godox 2560 - goerr113 2561 - gofmt 2562 - gofumpt 2563 - goheader 2564 - goimports 2565 - golint 2566 - gomnd 2567 - gomoddirectives 2568 - gomodguard 2569 - goprintffuncname 2570 - gosec 2571 - gosimple 2572 - gosmopolitan 2573 - govet 2574 - grouper 2575 - ifshort 2576 - importas 2577 - inamedparam 2578 - ineffassign 2579 - interfacebloat 2580 - interfacer 2581 - ireturn 2582 - lll 2583 - loggercheck 2584 - maintidx 2585 - makezero 2586 - maligned 2587 - mirror 2588 - misspell 2589 - musttag 2590 - nakedret 2591 - nestif 2592 - nilerr 2593 - nilnil 2594 - nlreturn 2595 - noctx 2596 - nolintlint 2597 - nonamedreturns 2598 - nosnakecase 2599 - nosprintfhostport 2600 - paralleltest 2601 - perfsprint 2602 - prealloc 2603 - predeclared 2604 - promlinter 2605 - protogetter 2606 - reassign 2607 - revive 2608 - rowserrcheck 2609 - scopelint 2610 - sloglint 2611 - spancheck 2612 - sqlclosecheck 2613 - staticcheck 2614 - structcheck 2615 - stylecheck 2616 - tagalign 2617 - tagliatelle 2618 - tenv 2619 - testableexamples 2620 - testifylint 2621 - testpackage 2622 - thelper 2623 - tparallel 2624 - typecheck 2625 - unconvert 2626 - unparam 2627 - unused 2628 - usestdlibvars 2629 - varcheck 2630 - varnamelen 2631 - wastedassign 2632 - whitespace 2633 - wrapcheck 2634 - wsl 2635 - zerologlint 2636 2637 # Enable presets. 2638 # https://golangci-lint.run/usage/linters 2639 # Default: [] 2640 presets: 2641 - bugs 2642 - comment 2643 - complexity 2644 - error 2645 - format 2646 - import 2647 - metalinter 2648 - module 2649 - performance 2650 - sql 2651 - style 2652 - test 2653 - unused 2654 2655 # Run only fast linters from enabled linters set (first run won't be fast) 2656 # Default: false 2657 fast: true 2658 2659 2660 issues: 2661 # List of regexps of issue texts to exclude. 2662 # 2663 # But independently of this option we use default exclude patterns, 2664 # it can be disabled by `exclude-use-default: false`. 2665 # To list all excluded by default patterns execute `golangci-lint run --help` 2666 # 2667 # Default: https://golangci-lint.run/usage/false-positives/#default-exclusions 2668 exclude: 2669 - abcdef 2670 2671 # Excluding configuration per-path, per-linter, per-text and per-source 2672 exclude-rules: 2673 # Exclude some linters from running on tests files. 2674 - path: _test\.go 2675 linters: 2676 - gocyclo 2677 - errcheck 2678 - dupl 2679 - gosec 2680 2681 # Run some linter only for test files by excluding its issues for everything else. 2682 - path-except: _test\.go 2683 linters: 2684 - forbidigo 2685 2686 # Exclude known linters from partially hard-vendored code, 2687 # which is impossible to exclude via `nolint` comments. 2688 # `/` will be replaced by current OS file path separator to properly work on Windows. 2689 - path: internal/hmac/ 2690 text: "weak cryptographic primitive" 2691 linters: 2692 - gosec 2693 2694 # Exclude some `staticcheck` messages. 2695 - linters: 2696 - staticcheck 2697 text: "SA9003:" 2698 2699 # Exclude `lll` issues for long lines with `go:generate`. 2700 - linters: 2701 - lll 2702 source: "^//go:generate " 2703 2704 # Independently of option `exclude` we use default exclude patterns, 2705 # it can be disabled by this option. 2706 # To list all excluded by default patterns execute `golangci-lint run --help`. 2707 # Default: true 2708 exclude-use-default: false 2709 2710 # If set to true exclude and exclude-rules regular expressions become case-sensitive. 2711 # Default: false 2712 exclude-case-sensitive: false 2713 2714 # The list of ids of default excludes to include or disable. 2715 # https://golangci-lint.run/usage/false-positives/#default-exclusions 2716 # Default: [] 2717 include: 2718 - EXC0001 2719 - EXC0002 2720 - EXC0003 2721 - EXC0004 2722 - EXC0005 2723 - EXC0006 2724 - EXC0007 2725 - EXC0008 2726 - EXC0009 2727 - EXC0010 2728 - EXC0011 2729 - EXC0012 2730 - EXC0013 2731 - EXC0014 2732 - EXC0015 2733 2734 # Maximum issues count per one linter. 2735 # Set to 0 to disable. 2736 # Default: 50 2737 max-issues-per-linter: 0 2738 2739 # Maximum count of issues with the same text. 2740 # Set to 0 to disable. 2741 # Default: 3 2742 max-same-issues: 0 2743 2744 # Show only new issues: if there are unstaged changes or untracked files, 2745 # only those changes are analyzed, else only changes in HEAD~ are analyzed. 2746 # It's a super-useful option for integration of golangci-lint into existing large codebase. 2747 # It's not practical to fix all existing issues at the moment of integration: 2748 # much better don't allow issues in new code. 2749 # 2750 # Default: false 2751 new: true 2752 2753 # Show only new issues created after git revision `REV`. 2754 # Default: "" 2755 new-from-rev: HEAD 2756 2757 # Show only new issues created in git patch with set file path. 2758 # Default: "" 2759 new-from-patch: path/to/patch/file 2760 2761 # Fix found issues (if it's supported by the linter). 2762 # Default: false 2763 fix: true 2764 2765 # Show issues in any part of update files (requires new-from-rev or new-from-patch). 2766 # Default: false 2767 whole-files: true 2768 2769 severity: 2770 # Set the default severity for issues. 2771 # 2772 # If severity rules are defined and the issues do not match or no severity is provided to the rule 2773 # this will be the default severity applied. 2774 # Severities should match the supported severity names of the selected out format. 2775 # - Code climate: https://docs.codeclimate.com/docs/issues#issue-severity 2776 # - Checkstyle: https://checkstyle.sourceforge.io/property_types.html#SeverityLevel 2777 # - GitHub: https://help.github.com/en/actions/reference/workflow-commands-for-github-actions#setting-an-error-message 2778 # - TeamCity: https://www.jetbrains.com/help/teamcity/service-messages.html#Inspection+Instance 2779 # 2780 # Default: "" 2781 default-severity: error 2782 2783 # If set to true `severity-rules` regular expressions become case-sensitive. 2784 # Default: false 2785 case-sensitive: true 2786 2787 # When a list of severity rules are provided, severity information will be added to lint issues. 2788 # Severity rules have the same filtering capability as exclude rules 2789 # except you are allowed to specify one matcher per severity rule. 2790 # Only affects out formats that support setting severity information. 2791 # 2792 # Default: [] 2793 rules: 2794 - linters: 2795 - dupl 2796 severity: info