.golangci.yml 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139
  1. service:
  2. golangci-lint-version: 1.61.x # use the fixed version to not introduce new linters unexpectedly
  3. run:
  4. concurrency: 4
  5. # timeout for analysis, e.g. 30s, 5m, default is 1m
  6. timeout: 20m
  7. build-tags:
  8. - integ
  9. - integfuzz
  10. linters:
  11. disable-all: true
  12. enable:
  13. - unused
  14. - errcheck
  15. - copyloopvar
  16. - gocritic
  17. - gofumpt
  18. - goimports
  19. - revive
  20. - gosimple
  21. - govet
  22. - ineffassign
  23. - lll
  24. - misspell
  25. - staticcheck
  26. - stylecheck
  27. - typecheck
  28. - unconvert
  29. - unparam
  30. - gci
  31. - gosec
  32. - asciicheck
  33. - prealloc
  34. - predeclared
  35. - makezero
  36. fast: false
  37. linters-settings:
  38. errcheck:
  39. # report about not checking of errors in type assetions: `a := b.(MyStruct)`;
  40. # default is false: such cases aren't reported by default.
  41. check-type-assertions: false
  42. # report about assignment of errors to blank identifier: `num, _ := strconv.Atoi(numStr)`;
  43. # default is false: such cases aren't reported by default.
  44. check-blank: false
  45. govet:
  46. # report about shadowed variables
  47. disable:
  48. - shadow
  49. maligned:
  50. # print struct with more effective memory layout or not, false by default
  51. suggest-new: true
  52. misspell:
  53. # Correct spellings using locale preferences for US or UK.
  54. # Default is to use a neutral variety of English.
  55. # Setting locale to US will correct the British spelling of 'colour' to 'color'.
  56. locale: US
  57. ignore-words:
  58. - cancelled
  59. - marshalled
  60. lll:
  61. # max line length, lines longer will be reported. Default is 120.
  62. # '\t' is counted as 1 character by default, and can be changed with the tab-width option
  63. line-length: 160
  64. # tab width in spaces. Default to 1.
  65. tab-width: 1
  66. gocritic:
  67. disabled-checks:
  68. - exitAfterDefer
  69. unused:
  70. check-exported: false
  71. unparam:
  72. # Inspect exported functions, default is false. Set to true if no external program/library imports your code.
  73. # XXX: if you enable this setting, unparam will report a lot of false-positives in text editors:
  74. # if it's called for subdir of a project it can't find external interfaces. All text editor integrations
  75. # with golangci-lint call it on a directory with the changed file.
  76. check-exported: false
  77. gci:
  78. sections:
  79. - standard
  80. - default
  81. - prefix(github.com/fatedier/frp/)
  82. gosec:
  83. severity: "low"
  84. confidence: "low"
  85. excludes:
  86. - G401
  87. - G402
  88. - G404
  89. - G501
  90. - G115 # integer overflow conversion
  91. issues:
  92. # List of regexps of issue texts to exclude, empty list by default.
  93. # But independently from this option we use default exclude patterns,
  94. # it can be disabled by `exclude-use-default: false`. To list all
  95. # excluded by default patterns execute `golangci-lint run --help`
  96. # exclude:
  97. # - composite literal uses unkeyed fields
  98. exclude-rules:
  99. # Exclude some linters from running on test files.
  100. - path: _test\.go$|^tests/|^samples/
  101. linters:
  102. - errcheck
  103. - maligned
  104. - linters:
  105. - revive
  106. - stylecheck
  107. text: "use underscores in Go names"
  108. - linters:
  109. - revive
  110. text: "unused-parameter"
  111. - linters:
  112. - unparam
  113. text: "is always false"
  114. exclude-dirs:
  115. - genfiles$
  116. - vendor$
  117. - bin$
  118. exclude-files:
  119. - ".*\\.pb\\.go"
  120. - ".*\\.gen\\.go"
  121. # Independently from option `exclude` we use default exclude patterns,
  122. # it can be disabled by this option. To list all
  123. # excluded by default patterns execute `golangci-lint run --help`.
  124. # Default value for this option is true.
  125. exclude-use-default: true
  126. # Maximum issues count per one linter. Set to 0 to disable. Default is 50.
  127. max-per-linter: 0
  128. # Maximum count of issues with the same text. Set to 0 to disable. Default is 3.
  129. max-same-issues: 0