golang-lint
Linting best practices and golangci-lint configuration for Golang projects — running linters, configuring .golangci.yml, suppressing warnings with nolint directives, interpreting lint output, and selecting linters. Use when configuring golangci-lint, asking about lint warnings or nolint suppressions, setting up code quality tooling, or choosing linters. Also use when the user mentions golangci-lint, go vet, staticcheck, or revive. Skill: golang-lint Owner: samber Summary: Linting best practices and golangci-lint configuration for Golang projects — running linters, configuring .golangci.yml, suppressing warnings with nolint directives, interpreting lint output, and selecting linters. Use when configuring golangci-lint, asking about lint warnings or nolint suppressions, setting up code quality tooling, or choosing linters. Also use when the user
Rank
62
Safety
84
Downloads
1.2k
Updated
Oct 11, 2026
Version
1.4.0
Source
CLAWHUB
About
What it does, and when to use it.
Capability contract not published. No trust telemetry is available yet. 1.2K downloads reported by the source. Last updated 10/11/2026.
Avoid when
- Contract metadata is missing or unavailable for deterministic execution.
Risk flags: missing_or_unavailable_contract, trust_data_unavailable, schema_references_missing
Public facts
Every fact links back to the source it came from.
- Vendor
- Clawhubvendor · observed Oct 11, 2026
- Protocol compatibility
- OpenClawcompatibility · observed Oct 11, 2026
- Adoption signal
- 1.2K downloadsadoption · observed Oct 11, 2026
- Latest release
- 1.4.0release · observed Aug 21, 2026
- Handshake status
- UNKNOWNsecurity
Install and run
Setup complexity: medium.
clawhub skill install s173arkhs3131fq5jf769qq75583hdgt:golang-lint- Setup complexity is MEDIUM. Standard integration tests and API key provisioning are required before connecting this to production workloads.
- Final validation: Expose the agent to a mock request payload inside a sandbox and trace the network egress before allowing access to real customer data.
Contract: missing
curl -s "https://www.xpersona.co/api/v1/agents/clawhub-samber-golang-lint/snapshot"
Documentation
CLAWHUB
142,585 characters of source documentation, loaded on request.
Extracted files
5 files captured from the source.
SKILL.md
---
name: golang-lint
description: "Linting best practices and golangci-lint configuration for Golang projects — running linters, configuring .golangci.yml, suppressing warnings with nolint directives, interpreting lint output, and selecting linters. Use when configuring golangci-lint, asking about lint warnings or nolint suppressions, setting up code quality tooling, or choosing linters. Also use when the user mentions golangci-lint, go vet, staticcheck, or revive."
user-invocable: true
license: MIT
compatibility: Designed for Claude Code, Codex or similar harness, and for projects using Golang.
metadata:
author: samber
version: "1.4.0"
openclaw:
emoji: "🧹"
homepage: https://github.com/samber/cc-skills-golang
requires:
bins:
- go
- golangci-lint
install:
- kind: brew
formula: golangci-lint
bins: [golangci-lint]
allowed-tools: Read Edit Write Glob Grep Bash(go:*) Bash(golangci-lint:*) Bash(git:*) Agent
paths:
- "**/*.go"
- ".golangci.yml"
---
**Persona:** You are a Go code quality engineer. You treat linting as a first-class part of the development workflow — not a post-hoc cleanup step.
**Orchestration mode:** Fan out the five sub-agents described in the "Parallelizing Legacy Codebase Cleanup" section (auto-fix, security linters, error handling, style/formatting, code quality) when adopting linting on a legacy codebase, so independent linter categories are fixed concurrently. On Claude Code, use `ultracode` to opt into multi-agent orchestration explicitly.
**Modes:**
- **Setup mode** — configuring `.golangci.yml`, choosing linters, enabling CI: follow the configuration and workflow sections sequentially.
- **Coding mode** — writing new Go code: launch a background agent running `golangci-lint run --fix` on the modified files only while the main agent continues implementing the feature; surface results when it completes.
- **Interpret/fix mode** — reading lint output, suppressing warnings, fixing issues on existing code: start from "Interpreting Output" and "Suppressing Lint Warnings"; use parallel sub-agents for large-scale legacy cleanup.
**Dependencies:**
- golangci-lint: `go install github.com/golangci/golangci-lint/cmd/golangci-lint@latest`
# Go Linting
## Overview
`golangci-lint` is the standard Go linting tool. It aggregates 100+ linters into a single binary, runs them in parallel, and provides a unified configuration format. Run it frequently during development and always in CI.
Every Go project MUST have a `.golangci.yml` — it is the **source of truth** for which linters are enabled and how they are configured. See the [recommended configuration](./assets/.golangci.yml) for a production-ready setup with 48 linters enabled.
## Quick Reference
```bash
# Run all configured linters
golangci-lint run ./...
# Auto-fix issues where possible
golangci-lint run --fix ./...
# Format code (golangci-lint v2+)
golangci-lint fmt ./...
# Run a single linter only
golang_meta.json
{
"ownerId": "kn72rhnkwjfeex9wr1n7y24qa983cjn3",
"slug": "golang-lint",
"version": "1.4.0",
"publishedAt": 1787329318465
}references/linter-reference.md
# Linter Reference golangci-lint v2 uses a `.golangci.yml` with `version: "2"` at the project root. Key sections of `.golangci.yml`: - **`run`** — concurrency, timeout, test inclusion, directory exclusions - **`linters.enable`** / **`linters.disable`** — which linters are active - **`linters.settings`** — per-linter thresholds and options - **`formatters`** — code formatters (gofmt, gofumpt) - **`issues`** — output limits, exclusion rules To add a linter: add it to `linters.enable` and optionally configure it in `linters.settings`. To disable a linter: move it to `linters.disable` with a comment explaining why. ## Linter Categories The recommended configuration enables linters across these domains: | Domain | Linters | Catches | | --- | --- | --- | | Correctness | govet, staticcheck, unused, errcheck, errorlint, nilerr, forcetypeassert, copyloopvar, durationcheck, reassign | Bugs, unchecked errors, stdlib misuse | | Style | gocritic, revive, wsl_v5, whitespace, godot, misspell, dupword, predeclared, errname, asciicheck | Readability, naming, consistency | | Complexity | gocyclo, nestif, funlen, dupl | Overly complex or duplicated code | | Performance | perfsprint, unconvert, ineffassign, goconst | Conversions, string ops, dead assigns | | Security | gosec, bidichk, bodyclose, noctx, containedctx, fatcontext, sqlclosecheck, rowserrcheck | Security issues, resource leaks (HTTP, SQL) | | Logging | sloglint, loggercheck | Structured log consistency | | Testing | thelper, paralleltest, testifylint, usetesting | Test hygiene and best practices | | Modernization | modernize, exptostd, intrange, usestdlibvars, exhaustive, nolintlint | Modern Go idioms, lint hygiene | | Formatting | gofmt, gofumpt | Code formatting | All linters are enabled in the [recommended .golangci.yml](../assets/.golangci.yml), organized by domain. ### Correctness & Safety - **govet** — Go's built-in checker: copylocks, printf format mismatches, struct tag validation, context stored in structs, unreachable code, nil dereferences - **staticcheck** — Extensive static analysis: deprecated APIs, common mistakes, unnecessary code, simplifications, misuse of standard library - **unused** — Detects unused variables, functions, types, and struct fields - **errcheck** — Ensures all error returns are checked, including type assertions (configured with `check-type-assertions: true`) - **nilerr** — Detects returning nil error when `err` is non-nil (common source of silent failures) - **forcetypeassert** — Flags type assertions without the comma-ok check (`v := x.(T)` instead of `v, ok := x.(T)`) - **copyloopvar** — Detects loop variable copy issues (Go 1.22+) - **errorlint** — Enforces correct use of `errors.Is`/`errors.As` and `%w` wrapping (Go 1.13+ error wrapping) - **durationcheck** — Detects `time.Duration * time.Duration` multiplication bugs (e.g., `2 * time.Second * time.Minute` produces nanoseconds squared, not seconds) - **reassign** — Detects reassignment of package-level v
references/nolint-directives.md
# Nolint Directives
## Syntax
```go
//nolint:lintername // justification explaining why this suppression is needed
```
Place the directive on the same line as the flagged code, or on the line immediately above it.
## Rules
1. **MUST specify the linter name** — bare `//nolint` suppresses all linters on that line and makes it impossible to track what is being suppressed
2. **MUST add a justification comment** — future readers (and your future self) need to understand why
3. **The `nolintlint` linter enforces both rules** — it will flag bare `//nolint` and missing reasons
4. **MUST fix the root cause before suppressing** — only suppress after confirming the issue is a false positive or an intentional pattern
## Examples
```go
// Specific linter with reason
//nolint:errcheck // fire-and-forget logging, error not actionable
_ = logger.Sync()
// Type assertion is safe because preceding type switch guarantees the type
v := x.(MyType) //nolint:forcetypeassert // guaranteed by type switch on line 42
// Orchestration function has inherent complexity
//nolint:gocyclo // orchestration function coordinating 8 subsystems
func orchestrate() error {
// Table-driven test with many cases
//nolint:funlen // table-driven test, length is proportional to case count
func TestParser(t *testing.T) {
// Intentional parallel structure is clearer than abstracting
//nolint:dupl // intentional parallel structure for readability
```
## Multiple Linters
Suppress multiple linters on one line with comma separation:
```go
//nolint:errcheck,gosec // fire-and-forget in test helper
```
## When to Suppress vs. When to Fix
**Fix** (almost always):
- `errcheck` — check the error, even if just logging it
- `govet` — these are usually real bugs
- `staticcheck` — deprecated API usage, logic errors
- `bodyclose`, `sqlclosecheck` — resource leaks are real issues
**Suppress** (with justification):
- `funlen` — table-driven tests with many cases
- `gocyclo` — orchestration functions where splitting would obscure the flow
- `dupl` — intentional parallel structure that is clearer than an abstraction
- `exhaustive` — when a default case intentionally handles remaining values
- `goconst` — when extracting to a constant would reduce clarity (e.g., test assertions)
**Never suppress without strong justification**:
- Security linters (`bodyclose`, `sqlclosecheck`, `rowserrcheck`) — these catch real resource leaks
- `errcheck` on production code paths — unchecked errors cause silent failuresskill-card.md
## Description: Linting best practices and golangci-lint configuration for Go projects, including running linters, configuring .golangci.yml, suppressing warnings with nolint directives, interpreting lint output, and selecting linters. This skill is ready for commercial/non-commercial use. ## Publisher: [samber](https://clawhub.ai/user/samber) ### License/Terms of Use: MIT-0 ## Use Case: Developers and engineers use this skill to set up golangci-lint, interpret and fix lint findings, write disciplined nolint suppressions, and adopt linting workflows in Go codebases. ### Deployment Geography for Use: Global ## Known Risks and Mitigations: Risk: Installing golangci-lint with an unpinned latest version can change lint behavior over time. Mitigation: Pin and review the golangci-lint version used by local setup and CI. Risk: Auto-fix commands can modify Go code in ways that still need developer review. Mitigation: Review diffs and run the relevant test suite before accepting --fix output. Risk: Using the skill outside Go linting work may produce irrelevant guidance. Mitigation: Invoke it for Go linting, golangci-lint configuration, lint-output interpretation, or nolint guidance. ## Reference(s): - [Project homepage](https://github.com/samber/cc-skills-golang) - [Linter Reference](references/linter-reference.md) - [Nolint Directives](references/nolint-directives.md) ## Skill Output: **Output Type(s):** [Text, Markdown, Code, Shell commands, Configuration, Guidance] **Output Format:** [Markdown with inline Go, YAML, Makefile, and shell snippets] **Output Parameters:** [1D] **Other Properties Related to Output:** [May propose golangci-lint commands, .golangci.yml changes, nolint directives, and cleanup plans for Go files.] ## Skill Version(s): 1.4.0 (source: release evidence and frontmatter) ## Ethical Considerations: Users should evaluate whether this skill is appropriate for their environment, review any generated or modified files before relying on them, and apply their organization's safety, security, and compliance requirements before deployment.
AionUi
Free, local, open-source 24/7 Cowork app and OpenClaw for Gemini CLI, Claude Code, Codex, OpenCode, Qwen Code, Goose CLI, Auggie, and more | 🌟 Star if you like it!
activepieces
AI Agents & MCPs & AI Workflow Automation • (~400 MCP servers for AI agents) • AI Automation / AI Agent with MCPs • AI Workflows & AI Agents • MCPs for AI Agents
cherry-studio
AI productivity studio with smart chat, autonomous agents, and 300+ assistants.
CopilotKit
The Frontend for Agents & Generative UI. React + Angular
Machine-readable data
The same record, as JSON, for agents and crawlers.
{
"facts": [
{
"factKey": "vendor",
"category": "vendor",
"label": "Vendor",
"value": "Clawhub",
"href": "https://clawhub.ai/samber/skills/golang-lint",
"sourceUrl": "https://clawhub.ai/samber/skills/golang-lint",
"sourceType": "profile",
"confidence": "medium",
"observedAt": "2026-10-11T01:49:39.382Z",
"isPublic": true
},
{
"factKey": "protocols",
"category": "compatibility",
"label": "Protocol compatibility",
"value": "OpenClaw",
"href": "https://www.xpersona.co/api/v1/agents/clawhub-samber-golang-lint/contract",
"sourceUrl": "https://www.xpersona.co/api/v1/agents/clawhub-samber-golang-lint/contract",
"sourceType": "contract",
"confidence": "medium",
"observedAt": "2026-10-11T01:49:39.382Z",
"isPublic": true
},
{
"factKey": "traction",
"category": "adoption",
"label": "Adoption signal",
"value": "1.2K downloads",
"href": "https://clawhub.ai/samber/golang-lint",
"sourceUrl": "https://clawhub.ai/samber/golang-lint",
"sourceType": "profile",
"confidence": "medium",
"observedAt": "2026-10-11T01:49:39.382Z",
"isPublic": true
},
{
"factKey": "latest_release",
"category": "release",
"label": "Latest release",
"value": "1.4.0",
"href": "https://clawhub.ai/samber/golang-lint",
"sourceUrl": "https://clawhub.ai/samber/golang-lint",
"sourceType": "release",
"confidence": "medium",
"observedAt": "2026-08-21T16:21:58.465Z",
"isPublic": true
},
{
"factKey": "handshake_status",
"category": "security",
"label": "Handshake status",
"value": "UNKNOWN",
"href": "https://www.xpersona.co/api/v1/agents/clawhub-samber-golang-lint/trust",
"sourceUrl": "https://www.xpersona.co/api/v1/agents/clawhub-samber-golang-lint/trust",
"sourceType": "trust",
"confidence": "medium",
"observedAt": null,
"isPublic": true
}
],
"events": [
{
"eventType": "release",
"title": "Release 1.4.0",
"description": "- Added explicit support for multi-agent orchestration and ultracode, enabling fan-out for parallel legacy codebase cleanup. - Clarified compatibility section for Claude Code and Codex. - Introduced a new \"paths\" field to specify lint-relevant files. - Updated metadata version to 1.4.0. - Removed obsolete skill-card.md.",
"href": "https://clawhub.ai/samber/golang-lint",
"sourceUrl": "https://clawhub.ai/samber/golang-lint",
"sourceType": "release",
"confidence": "medium",
"observedAt": "2026-08-21T16:21:58.465Z",
"isPublic": true
}
]
}Record generated Oct 11, 2026.
