go-linting
Skill9 starsChanged 8 months agoMITView on GitHub
Use when setting up linting, configuring golangci-lint, or fixing linter warnings in Go projects. Provides recommended linter sets, golangci-lint configuration, CI integration, and Makefile targets.
- Installs packages
3 other projects use a version of this.
Adopted by
Most recently taken up by
- muratmirgun/gopherstheir own version, first seen Aug 11, 2026
- cxuu/golang-skillstheir own version, first seen Jun 20, 2026
- abdullahkhawer/devops-skillstheir own version, first seen May 7, 2026
Other versions3 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 3
- cxuu/golang-skills★ 165same name
- muratmirgun/gophers★ 9same name
- abdullahkhawer/devops-skills★ 8same name
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository8 other files it gives its agents.
- golangSkill
- go-code-reviewSkill
- go-concurrencySkill
- go-error-handlingSkill
- go-performanceSkill
- go-project-layoutSkill
- go-securitySkill
- go-testingSkill
The file
We split this skill into the rules it gives an agent
4 rules. 0 are common, 1 is distinctive, and 3 are very specific to this project.
0
Common
Most of the 3 edited versions we read keep these.
1
Distinctive
This author's own choices. Worth a look.
3
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 33
Place .golangci.yml at the project root.
- Very specific: line 116
Update local-prefixes under formatters.settings.goimports to match your module path.
- Distinctive: line 132
If golangci-lint is not a tool dependency:
- Very specific: line 218
Use //nolint comments sparingly.
“Common” is measured: kept by at least 6 in 10 of the 3 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Go Linting
Recommended linters and configuration for Go projects.
golangci-lint Setup
golangci-lint is the standard linter aggregator for Go. Install it as a tool dependency in your module:
# Add to go.mod (Go 1.24+)
go get -tool github.com/golangci/golangci-lint/cmd/golangci-lint
# Or install directly
go install github.com/golangci/golangci-lint/cmd/golangci-lint@latestRecommended Configuration
Place .golangci.yml at the project root. This uses the golangci-lint v2 config format:
version: "2"
run:
timeout: 5m
go: "1.25"
linters:
enable:
- errcheck # unchecked errors
- govet # go vet checks
- staticcheck # comprehensive static analysis (includes gosimple)
- revive # flexible linter, replaces golint
- ineffassign # unused assignments
- unused # unused code
- misspell # spelling in comments and strings
- unconvert # unnecessary type conversions
- gocritic # opinionated style and performance checks
- errname # error naming conventions (Err prefix)
- errorlint # error wrapping patterns
- copyloopvar # loop variable copy issues (pre-Go 1.22)
- nilerr # returning nil when err is not nil
- bodyclose # unclosed HTTP response bodies
- prealloc # slice preallocation
settings:
revive:
rules:
- name: exported
arguments:
- "checkPrivateReceivers"
- name: blank-imports
- name: context-as-argument
- name: context-keys-type
- name: error-return
- name: error-strings
- name: error-naming
- name: increment-decrement
- name: var-naming
- name: package-comments
- name: range
- name: receiver-naming
- name: indent-error-flow
- name: empty-block
- name: superfluous-else
- name: unreachable-code
- name: redefines-builtin-id
gocritic:
enabled-tags:
- diagnostic
- style
- performance
errcheck:
check-type-assertions: true
check-blank: true
govet:
enable-all: true
exclusions:
rules:
# Allow unused parameters in interface implementations
- linters:
- revive
text: "unused-parameter"
# Test files can use dot imports
- path: _test\.go
linters:
- revive
text: "dot-imports"
formatters:
enable:
- goimports # import formatting and grouping
settings:
goimports:
local-prefixes:
- yourcompany.com
issues:
max-issues-per-linter: 0
max-same-issues: 0Update local-prefixes under formatters.settings.goimports to match your module path.
Note: this config uses golangci-lint v2 format (version: "2"). If you are on golangci-lint v1, run golangci-lint migrate to convert, or remove the version line and move formatters back into linters.
Makefile Integration
.PHONY: lint lint-fix
lint: ## Run linters
go tool golangci-lint run ./...
lint-fix: ## Run linters with auto-fix
go tool golangci-lint run --fix ./...If golangci-lint is not a tool dependency:
lint:
golangci-lint run ./...CI Integration
GitHub Actions
name: lint
on: [push, pull_request]
jobs:
golangci-lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version: "1.25"
- uses: golangci/golangci-lint-action@v6
with:
version: latestPer-Linter Guidance
errcheck
Finds unchecked errors. Fix by handling or explicitly ignoring:
// Wrong: error ignored silently
json.Unmarshal(data, &v)
// Correct: handle the error
if err := json.Unmarshal(data, &v); err != nil {
return fmt.Errorf("unmarshal config: %w", err)
}errorlint
Enforces proper error wrapping and comparison:
// errorlint flags this: use errors.Is instead
if err == ErrNotFound { }
// Correct
if errors.Is(err, ErrNotFound) { }bodyclose
Catches unclosed HTTP response bodies:
resp, err := http.Get(url)
if err != nil {
return err
}
defer resp.Body.Close() // bodyclose checks for thisgovet
Runs the same checks as go vet plus additional analyzers. Key checks:
- printf: format string / argument mismatch
- shadow: variable shadowing
- structtag: malformed struct tags
- copylocks: passing locks by value
Suppressing False Positives
//nolint:errcheck // intentionally ignoring close error on read-only file
_ = f.Close()
//nolint:gocritic // hugeParam: passing by value is intentional here
func process(cfg Config) { }Use //nolint comments sparingly. Prefer fixing the issue over suppressing it.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

