golang-lint

Diagnose golangci-lint warnings and guide fixes in Go codebases.

2|Updated Mar 13, 2023
One-click install
npx skills add https://github.com/haipham22/golang-sample --skill golang-lint-haipham22
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: golang-lint
Source: https://github.com/haipham22/golang-sample/tree/main/.agents/skills/golang-lint
Command: npx skills add https://github.com/haipham22/golang-sample --skill golang-lint-haipham22

SYSTEM DOCUMENTATION & REQUIREMENTS

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

What problem does it solve?

This Skill helps Go teams configure, interpret, and act on golangci-lint results so they can catch real bugs early, keep lint hygiene consistent, and avoid noisy or unsafe suppressions.

Core Features & Use Cases

  • Configuration Guidance: Set up golangci-lint v2 with the right run, linters, formatters, and issues sections.
  • Lint Triage: Decide whether to fix or suppress warnings based on linter category, risk, and code intent.
  • Nolint Hygiene: Write precise //nolint directives with linter names and justifications, including multi-linter suppressions.
  • Legacy Adoption: Roll out linting incrementally on existing codebases without being overwhelmed by historical warnings.
  • Formatter Setup: Separate formatting concerns from linting and use gofumpt and gofmt correctly.

Quick Start

Ask the golang-lint skill to review your Go project’s lint setup, explain the warnings, and recommend safe fixes or justified suppressions.

Frequently Asked Questions about golang-lint

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

FAQPage Schema
How do I configure golangci-lint v2 for my Go project?

To configure golangci-lint v2, you need to set up run, linters, formatters, and issues sections in your config file to define rule sets and formatting constraints. This ensures your Go codebase catches bugs early and maintains consistent lint hygiene.

What is the best way to write a nolint directive in Go?

The best way to write a nolint directive is to specify the exact linter names and provide a clear justification for suppressing the warning. Proper nolint hygiene prevents noisy or unsafe suppressions while maintaining code intent.

How do I adopt linting on a legacy Go codebase without too many warnings?

To adopt linting on a legacy Go codebase incrementally, you should roll out linters in stages and triage historical warnings. This prevents your team from being overwhelmed while progressively improving overall code quality.

Should I use gofumpt or gofmt for Go formatting?

You should separate formatting concerns from linting by using gofumpt and gofmt correctly within your golangci-lint v2 formatters section. This distinction ensures formatting rules are applied cleanly alongside lint checks.

How do I decide whether to fix or suppress a golangci-lint warning?

To decide whether to fix or suppress a golangci-lint warning, evaluate the linter category, risk level, and code intent. This triage process ensures you only suppress warnings safely when the code behavior is explicitly intended.