.golangci.yml 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120
  1. linters:
  2. # please, do not use `enable-all`: it's deprecated and will be removed soon.
  3. # inverted configuration with `enable-all` and `disable` is not scalable during updates of golangci-lint
  4. disable-all: true
  5. enable:
  6. - bodyclose
  7. - depguard
  8. - dogsled
  9. - dupl
  10. - errcheck
  11. - exportloopref
  12. - funlen
  13. - goconst
  14. # - gocritic
  15. - gocyclo
  16. - gofmt
  17. - goimports
  18. - goprintffuncname
  19. - gosimple
  20. - govet
  21. - ineffassign
  22. - misspell
  23. - nolintlint
  24. - rowserrcheck
  25. - staticcheck
  26. - stylecheck
  27. # - typecheck
  28. - unconvert
  29. - unparam
  30. - unused
  31. - whitespace
  32. # - revive
  33. issues:
  34. include:
  35. - EXC0002 # disable excluding of issues about comments from golint
  36. exclude-rules:
  37. - linters:
  38. - stylecheck
  39. text: "ST1000:"
  40. # Excluding configuration per-path, per-linter, per-text and per-source
  41. - path: _test\.go
  42. linters:
  43. - gomnd
  44. # https://github.com/go-critic/go-critic/issues/926
  45. - linters:
  46. - gocritic
  47. text: "unnecessaryDefer:"
  48. linters-settings:
  49. funlen:
  50. lines: 66
  51. statements: 50
  52. errcheck:
  53. # Report about not checking of errors in type assertions: `a := b.(MyStruct)`.
  54. # Such cases aren't reported by default.
  55. # Default: false
  56. check-type-assertions: true
  57. # report about assignment of errors to blank identifier: `num, _ := strconv.Atoi(numStr)`.
  58. # Such cases aren't reported by default.
  59. # Default: false
  60. check-blank: true
  61. # To disable the errcheck built-in exclude list.
  62. # See `-excludeonly` option in https://github.com/kisielk/errcheck#excluding-functions for details.
  63. # Default: false
  64. disable-default-exclusions: true
  65. # List of functions to exclude from checking, where each entry is a single function to exclude.
  66. # See https://github.com/kisielk/errcheck#excluding-functions for details.
  67. exclude-functions:
  68. - io/ioutil.ReadFile
  69. - io.Copy(*bytes.Buffer)
  70. - io.Copy(os.Stdout)
  71. - (*bytes.Buffer).WriteString
  72. - (*bytes.Buffer).Write
  73. - url.Parse
  74. - (*strings.Builder).WriteString
  75. - io.WriteString
  76. - (*bytes.Buffer).WriteByte
  77. - (*hmac.New).Write
  78. - (*int)
  79. - (*string)
  80. - (hash.Hash).Write
  81. depguard:
  82. # Rules to apply.
  83. #
  84. # Variables:
  85. # - File Variables
  86. # you can still use and exclamation mark ! in front of a variable to say not to use it.
  87. # Example !$test will match any file that is not a go test file.
  88. #
  89. # `$all` - matches all go files
  90. # `$test` - matches all go test files
  91. #
  92. # - Package Variables
  93. #
  94. # `$gostd` - matches all of go's standard library (Pulled from `GOROOT`)
  95. #
  96. # Default: Only allow $gostd in all files.
  97. rules:
  98. # Name of a rule.
  99. main:
  100. # Used to determine the package matching priority.
  101. # There are three different modes: `original`, `strict`, and `lax`.
  102. # Default: "original"
  103. list-mode: lax
  104. # List of file globs that will match this list of settings to compare against.
  105. # Default: $all
  106. files:
  107. - "!**/*_a _file.go"
  108. # List of allowed packages.
  109. allow:
  110. - $gostd
  111. - github.com/OpenPeeDeeP
  112. # Packages that are not allowed where the value is a suggestion.
  113. deny:
  114. - pkg: "github.com/pkg/errors"
  115. desc: Should be replaced by standard lib errors package