Skip to content

Instantly share code, notes, and snippets.

@gen0cide
Created September 1, 2019 00:38
Show Gist options
  • Save gen0cide/765c73c88b1e0a616d875b44e8ba9c45 to your computer and use it in GitHub Desktop.
Save gen0cide/765c73c88b1e0a616d875b44e8ba9c45 to your computer and use it in GitHub Desktop.
GolangCI Config
run:
deadline: 30s
skip-dirs:
- "vendor"
- "go-build"
- "\\.gen"
- ".*/\\.tmp/.*$"
- ".*/go-build/\\.go/.*$"
- ".*/go-build/\\.tmp/.*$"
- ".*/vendor/.*$"
tests: false
skip-files:
- ".*generated_.*types\\.go$"
linters:
disable-all: true
enable:
- deadcode
- errcheck
- goconst
- gocritic
- gocyclo
- gofmt
- goimports
- golint
- gosec
- gosimple
- govet
- ineffassign
- interfacer
- maligned
- nakedret
- prealloc
- scopelint
- staticcheck
- structcheck
- typecheck
- unconvert
- unparam
- unused
- varcheck
linter-settings:
errcheck:
check-type-assertions: true
check-blank: true
ignore: "fmt:.*,io/ioutil:^Read.*,pp:.*"
goconst:
min-len: 3
min-occurrences: 6
gofmt:
simplify: true
gocritic:
enabled-tags:
- diagnostic
- performance
- style
- expirimental
- opinionated
disabled-checks:
- wrapperFunc
- regexpMust
settings:
captLocal:
paramsOnly: true
rangeValCopy:
sizeThreshold: 32
gocyclo:
min-complexity: 20
golint:
min-confidence: 0.7
govet:
check-shadowing: true
maligned:
suggest-new: true
nakedret:
max-func-lines: 50
prealloc:
simple: true
range-loops: true
for-loops: true
issues:
exclude-use-default: false
exclude:
# errcheck: Almost all programs ignore errors on these functions and in most cases it's ok
- Error return value of .((os\.)?std(out|err)\..*|.*Close|.*Flush|os\.Remove(All)?|.*printf?|os\.(Un)?Setenv). is not checked
# golint: False positive when tests are defined in package 'test'
- func name will be used as test\.Test.* by other packages, and that stutters; consider calling this
# staticcheck: Developers tend to write in C-style with an explicit 'break' in a 'switch', so it's ok to ignore
- ineffective break statement. Did you mean to break out of the outer loop
# gosec: Too many false-positives for parametrized shell calls
- Subprocess launch(ed with variable|ing should be audited)
# gosec: Duplicated errcheck checks
- G104
# gosec: Too many issues in popular repos
- (Expect directory permissions to be 0750 or less|Expect file permissions to be 0600 or less)
# gosec: False positive is triggered by 'src, err := ioutil.ReadFile(filename)'
- Potential file inclusion via variable
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment