Installation
About 388 wordsAbout 1 min
2025-01-16
golint-sl runs as a golangci-lint module plugin. This gives you unified configuration, nolint directives, and seamless integration with your existing linting setup.
Prerequisites
- Go 1.21 or later
- golangci-lint v2.0 or later (install guide)
Verify golangci-lint is installed:
golangci-lint versionStep 1: Create .custom-gcl.yml
Add this file to your project root:
version: v2.8.0
plugins:
- module: 'github.com/spechtlabs/golint-sl'
version: v0.1.0 # Use latest versionThis tells golangci-lint to build a custom binary with golint-sl included.
Step 2: Build the Custom Binary
golangci-lint customThis creates a ./custom-gcl binary in your project directory.
Tips
You only need to rebuild when you change the golangci-lint version or the golint-sl version in .custom-gcl.yml.
Step 3: Configure .golangci.yml
Enable the plugin in your golangci-lint configuration:
version: "2"
linters:
enable:
- golint-sl
settings:
custom:
golint-sl:
type: module
description: SpechtLabs Go linter collection
original-url: github.com/spechtlabs/golint-slStep 4: Run
./custom-gcl run ./...Verify the Plugin
Confirm golint-sl is loaded:
./custom-gcl linters | grep golint-slTroubleshooting
golangci-lint Not Found
Ensure golangci-lint is installed and in your PATH:
# Install golangci-lint v2
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin v2.8.0Build Fails
If golangci-lint custom fails:
- Ensure your Go version is 1.21 or later:
go version - Ensure
go.modexists and modules are downloaded:go mod download - Check that the golint-sl version in
.custom-gcl.ymlexists on the module proxy
Plugin Not Loaded
If ./custom-gcl linters | grep golint-sl returns nothing:
- Ensure
.golangci.ymlhasgolint-slin theenablelist - Ensure the
settings.custom.golint-sl.typeis set tomodule - Rebuild the binary:
golangci-lint custom
Standalone Binary (Advanced)
For quick local testing or development, you can also install golint-sl as a standalone binary:
go install github.com/spechtlabs/golint-sl/cmd/golint-sl@latest
golint-sl ./...The standalone binary uses its own configuration file (.golint-sl.yaml) and CLI flags. See the CLI Reference for details. For production use, the golangci-lint plugin is strongly recommended.
Next Steps
- Quick Start - Run your first analysis
- GitHub Actions - Set up CI integration
