Skip to content

Instantly share code, notes, and snippets.

@tho
Last active August 15, 2024 12:56
Show Gist options
  • Save tho/8f75e77fb42b49aaf30cf8131b6d4b1e to your computer and use it in GitHub Desktop.
Save tho/8f75e77fb42b49aaf30cf8131b6d4b1e to your computer and use it in GitHub Desktop.
golangci-lint configuration
# For details see:
# - https://golangci-lint.run/usage/configuration/
# - https://golangci-lint.run/usage/linters/
run:
issues-exit-code: 2
modules-download-mode: readonly
output:
sort-results: true
linters-settings:
copyloopvar:
check-alias: true
decorder:
dec-order:
- const
- var
- type
- func
disable-dec-order-check: false
disable-init-func-first-check: false
disable-dec-num-check: false
disable-type-dec-num-check: true
depguard:
rules:
main:
list-mode: strict
allow:
- $gostd
- github.com
errcheck:
check-type-assertions: true
errchkjson:
report-no-exported: true
exhaustive:
default-signifies-exhaustive: true
funlen:
ignore-comments: true
gci:
sections:
- standard
- default
- localmodule
gocritic:
enabled-tags:
- diagnostic
- style
- performance
- experimental
- opinionated
gofmt:
rewrite-rules:
- pattern: 'interface{}'
replacement: 'any'
- pattern: 'a[b:len(a)]'
replacement: 'a[b:]'
- pattern: 'a[0:b]'
replacement: 'a[:b]'
gosimple:
checks: ["all"]
govet:
enable-all: true
lll:
line-length: 120
makezero:
always: true
nlreturn:
block-size: 4
revive:
enable-all-rules: true
rules:
- name: add-constant
disabled: true # goconst is used instead
- name: unhandled-error
disabled: true # errcheck is used instead
- name: function-length
disable: true # funlen is used instead
- name: line-length-limit
disabled: true # lll is used instead
sloglint:
attr-only: true
no-global: "all"
static-msg: true
key-naming-case: "snake"
args-on-sep-lines: true
staticcheck:
checks: ["all"]
stylecheck:
checks: ["all"]
tagliatelle:
case:
use-field-name: true
rules:
json: snake
testifylint:
enable-all: true
linters:
enable-all: true
disable:
- execinquery # Deprecated
- exhaustruct
- gomnd # Deprecated
- wsl
issues:
exclude-rules:
- path: _test\.go
linters:
- funlen
- linters:
- lll
source: "^//go:generate "
# https://github.com/Djarvur/go-err113/issues/10
- linters:
- err113
text: "do not define dynamic errors"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment