Configure Analyzers
About 378 wordsAbout 1 min
2025-01-16
Customize which analyzers run and how they behave through the golangci-lint plugin settings.
Configuration File
All golint-sl configuration lives in .golangci.yml under the plugin settings:
version: "2"
linters:
enable:
- golint-sl
settings:
custom:
golint-sl:
type: module
description: SpechtLabs Go linter collection
original-url: github.com/spechtlabs/golint-sl
settings:
disabled-analyzers:
- todotracker
- reconcilerDisabling Specific Analyzers
All analyzers are enabled by default. Disable ones that don't apply to your project by adding them to the disabled-analyzers list:
settings:
custom:
golint-sl:
type: module
settings:
disabled-analyzers:
# Not a Kubernetes project
- reconciler
- statusupdate
- sideeffects
# Our project uses different logging patterns
- wideevents
- contextloggerProject-Type Configurations
Backend API Service
settings:
custom:
golint-sl:
type: module
settings:
disabled-analyzers:
# Not a Kubernetes project
- reconciler
- statusupdate
- sideeffectsKubernetes Operator
settings:
custom:
golint-sl:
type: module
settings:
disabled-analyzers:
# Operators use controller-runtime logging
- wideevents
- contextloggerCLI Tool
settings:
custom:
golint-sl:
type: module
settings:
disabled-analyzers:
# CLIs often don't use context heavily
- contextpropagation
# CLIs use different logging
- wideevents
- contextlogger
# Not a Kubernetes project
- reconciler
- statusupdate
- sideeffectsLibrary Package
settings:
custom:
golint-sl:
type: module
settings:
disabled-analyzers:
# Let consumers decide logging
- wideevents
- contextlogger
# Not a Kubernetes project
- reconciler
- statusupdate
- sideeffectsListing All Analyzers
See all available analyzers:
./custom-gcl linters | grep golint-slFor a full list of analyzer names and descriptions, see the Plugin Settings Reference.
Verifying Configuration
Run the linter and check which analyzers are active:
./custom-gcl run -v ./... 2>&1 | head -50The verbose output shows which linters are enabled.
Combining with Other Linters
Since golint-sl runs as a golangci-lint plugin, you can enable it alongside any other golangci-lint linter:
version: "2"
linters:
enable:
- golint-sl
- govet
- staticcheck
- errcheck
- gosimple
- ineffassign
# Disable linters that overlap with golint-sl
disable:
- nilerr # Using golint-sl's nilcheck
- bodyclose # Using golint-sl's resourceclose
- contextcheck # Using golint-sl's contextpropagation
settings:
custom:
golint-sl:
type: module
description: SpechtLabs Go linter collection
original-url: github.com/spechtlabs/golint-sl
settings:
disabled-analyzers:
- reconciler
- statusupdate
- sideeffectsNext Steps
- Disable Analyzers - Suppress specific warnings
- Reference: Configuration - Full configuration reference
- Reference: Analyzers - Individual analyzer documentation
