Skip to content

Instantly share code, notes, and snippets.

@42wim
Last active January 6, 2020 20:45
Show Gist options
  • Save 42wim/06b1a9ebf8b305ce712bcfe366fb46a5 to your computer and use it in GitHub Desktop.
Save 42wim/06b1a9ebf8b305ce712bcfe366fb46a5 to your computer and use it in GitHub Desktop.
golangci-lint usage
# options for analysis running
run:
deadline: 2m
issues-exit-code: 1
tests: true
# modules-download-mode: vendor
skip-files:
- rice-box.go
# output configuration options
output:
format: colored-line-number
print-issued-lines: true
print-linter-name: true
# all available settings of specific linters
linters-settings:
errcheck:
check-type-assertions: false
check-blank: false
govet:
check-shadowing: true
golint:
min-confidence: 0.8
gofmt:
simplify: true
goimports:
gocyclo:
min-complexity: 25
maligned:
suggest-new: false
dupl:
threshold: 100
goconst:
min-len: 3
min-occurrences: 3
misspell:
locale: US
lll:
line-length: 120
tab-width: 1
unused:
check-exported: false
unparam:
check-exported: false
nakedret:
max-func-lines: 30
prealloc:
# XXX: we don't recommend using this linter before doing performance profiling.
simple: true
range-loops: true # Report preallocation suggestions on range loops, true by default
for-loops: false # Report preallocation suggestions on for loops, false by default
gocritic:
enabled-checks:
- appendAssign
- appendCombine
- assignOp
- boolExprSimplify
- builtinShadow
- captLocal
- caseOrder
- defaultCaseOrder
- dupArg
- dupBranchBody
- dupCase
- dupSubExpr
- elseif
- emptyFallthrough
- emptyStringTest
- flagDeref
- flagName
- hexLiteral
- ifElseChain
- importShadow
- indexAlloc
- methodExprCall
- nestingReduce
- nilValReturn
- offBy1
- ptrToRefParam
- regexpMust
- singleCaseSwitch
- sloppyLen
#- sloppyReassign
- switchTrue
- typeAssertChain
- typeSwitchVar
- typeUnparen
- underef
- unlambda
- unnecessaryBlock
- unslice
- valSwap
- wrapperFunc
- yodaStyleExpr
issues:
exclude-use-default: true
max-per-linter: 0
max-same-issues: 0
new: false
# linters that we should / shouldn't run
linters:
enable-all: true
disable:
- gochecknoglobals
- lll
- maligned
- prealloc
- wsl
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment