go-lint

Configure and run golangci-lint quality gates for Go codebases.

1|2|Updated Nov 25, 2017
One-click install
npx skills add https://github.com/asarchami/dotfiles --skill go-lint-asarchami
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: go-lint
Source: https://github.com/asarchami/dotfiles/tree/main/dot_config/opencode/skills/go/go-lint
Command: npx skills add https://github.com/asarchami/dotfiles --skill go-lint-asarchami

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) and assets (resource) components.

What problem does it solve? Go projects accumulate lint debt, inconsistent style, and unchecked errors when there is no enforced quality gate. This Skill provides a production-ready golangci-lint configuration, a complete linting pipeline, and a review framework so every change passes the same bar before merging. ## Core Features & Use Cases - Production golangci-lint config: A v2 .golangci.yml with 33+ enabled linters organized by domain (correctness, style, complexity, performance, security, testing), each with documented rationale. - Quality gate pipeline: Wires gofmt, go vet, go test with race and coverage, golangci-lint, gosec, and govulncheck into a single local and CI gate with concrete metric targets (coverage ≥80%, complexity ≤10, zero gosec findings). - nolint discipline and PR review framework: Enforces justified, linter-specific suppressions via nolintlint and organizes review feedback into Critical, Important, Suggestion, and Positive buckets. - Use Case: When inheriting a legacy Go repository, apply issues.new-from-rev: HEAD~1 so only new code is gated, then parallelize cleanup across linter categories until the full gate passes. ## Quick Start Set up a golangci-lint quality gate for my Go repository using the recommended configuration and show me how to run it locally.

Frequently Asked Questions about go-lint

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I set up golangci-lint for a Go project?

Create a .golangci.yml file at the repo root with version "2", enable linters by domain (correctness, style, complexity, security, testing), and run golangci-lint run ./... locally and in CI. Start from a curated config with documented rationale for each linter.

How to run golangci-lint only on new code in legacy repos?

Set issues.new-from-rev to HEAD~1 in .golangci.yml so only changed lines are gated. This prevents existing lint debt from blocking new diffs while you track and clean up the backlog separately.

Which linters should I enable in golangci-lint?

Enable linters across domains: govet, staticcheck, errcheck for correctness; gocritic and revive for style; gocyclo and funlen for complexity; gosec, bodyclose, sqlclosecheck for security; thelper and testifylint for tests. Disable noisy ones like mnd and varnamelen.

When should I use //nolint to suppress a linter warning?

Suppress only after confirming a false positive or intentional pattern, always naming the specific linter and adding a justification comment. Never blanket-suppress security linters like bodyclose or sqlclosecheck; the nolintlint linter enforces both rules.

Why does golangci-lint fail with deadline exceeded?

The default analysis timeout is 5 minutes, which large repos can exceed. Raise run.timeout in .golangci.yml, or reduce run.concurrency and add run.skip-dirs to speed up analysis on big codebases.

How do I migrate golangci-lint config from v1 to v2?

Run golangci-lint migrate to convert a v1 configuration to the v2 format automatically. The v2 config requires version: "2" at the top and restructures some settings sections.