.golangci.yml 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  1. run:
  2. tests: false
  3. modules-download-mode: readonly
  4. # Define the Go version limit.
  5. # Mainly related to generics support in go1.18.
  6. # Default: use Go version from the go.mod file, fallback on the env var `GOVERSION`, fallback on 1.18
  7. go: '1.22'
  8. issues:
  9. # The linter has a default list of ignorable errors. Turning this on will enable that list.
  10. exclude-use-default: false
  11. # Maximum issues count per one linter. Set to 0 to disable. Default is 50.
  12. max-issues-per-linter: 0
  13. # Maximum count of issues with the same text. Set to 0 to disable. Default is 3.
  14. max-same-issues: 0
  15. exclude:
  16. - Subprocess launch(ed with variable|ing should be audited)
  17. - Error return value of .((os\.)?std(out|err)\..*|.*Close|.*Flush|os\.Remove(All)?|.*print(f|ln)?|os\.(Un)?Setenv). is not checked
  18. - G307 # Allow closing files as a defer without checking error.
  19. - composite literal uses unkeyed fields
  20. linters:
  21. enable:
  22. - bodyclose
  23. - dupl
  24. - errcheck
  25. - goconst
  26. - godot
  27. - godox
  28. - goimports
  29. - goprintffuncname
  30. - gosec
  31. - govet
  32. - misspell
  33. - prealloc
  34. - revive
  35. - rowserrcheck
  36. - sqlclosecheck
  37. - staticcheck
  38. - unconvert
  39. - unparam
  40. - whitespace
  41. - nakedret
  42. - cyclop
  43. - gosimple
  44. - unused
  45. - copyloopvar
  46. - gocritic
  47. - forbidigo
  48. - unparam
  49. - wastedassign
  50. linters-settings:
  51. govet:
  52. disable:
  53. - composite
  54. cyclop:
  55. # the maximal code complexity to report. default is 10. eventually work our way to that.
  56. max-complexity: 15
  57. # the max average package complexity. If it's higher than 0.0 (float) the check is enabled (default 0.0)
  58. package-average: 0.0
  59. # should ignore tests
  60. skip-tests: true
  61. gocritic:
  62. disabled-checks:
  63. - ifElseChain
  64. - exitAfterDefer
  65. revive:
  66. rules:
  67. - name: package-comments
  68. disabled: true
  69. forbidigo:
  70. # Forbid the following identifiers (identifiers are written using regexp):
  71. forbid:
  72. # Logging via Print bypasses our logging framework.
  73. - ^(fmt\.Print(|f|ln)|print|println)
  74. - ^panic.*$
  75. dupl:
  76. # tokens count to trigger issue, 150 by default
  77. threshold: 200