linting-go-code
Linting Go Code
All commands run from the Go module root (installer/).
Lint
task lint
Runs golangci-lint (the master linter — all individual linters run through it) plus typos for spell checking. Auto-fixes what it can.
Format
task fmt
Formats code through golangci-lint (gofumpt + goimports + golines). Never run these formatters standalone — always use task fmt.
Nolint Directives
When suppressing a lint in code, the configuration requires both a specific linter name and an explanation:
//nolint:gochecknoinits // Cobra requires an init function to set up the command structure.
Blanket //nolint without a linter name is not allowed.
When Lints Fail
- Read the linter's message — golangci-lint identifies which linter flagged the issue
- Fix the code to satisfy the linter when possible
- If the lint is a false positive, suppress with a
//nolint:lintername // reasondirective - For linter configuration details (which linters are enabled, thresholds, exclusions), read
.golangci.yml
More from mrpointer/dotfiles
configuring-zsh
Configure and troubleshoot Zsh shell. Use when editing .zshenv, .zprofile, .zshrc, .zlogin, or .zlogout, setting up powerlevel10k prompt, configuring oh-my-zsh or sheldon plugin manager, fixing PATH or environment variables, debugging slow shell startup, setting up completions/compinit/fpath, or working with zsh-autocomplete, zsh-autosuggestions, or zsh-syntax-highlighting plugins.
20configuring-github-actions
Create and troubleshoot GitHub Actions workflows. Use when editing .github/workflows files, setting up CI/CD pipelines, configuring matrix builds for multi-platform testing, debugging failing workflows, adding caching or artifacts, running E2E tests in containers, or asking "why is my workflow failing" or "how do I test on multiple OSes".
11managing-chezmoi
Manage dotfiles with chezmoi. Use when adding files to chezmoi, running chezmoi add/apply/diff/status, debugging why changes aren't appearing, working with chezmoi templates or .chezmoiignore, understanding source vs target files, resolving merge conflicts, or asking "how do I manage this file with chezmoi". For chezmoi command uncertainties, use Context7 to fetch latest docs.
2writing-go-tests
Write Go tests following project conventions. Use when creating test files, writing unit or integration tests, choosing mocks, or setting up test fixtures. Covers test naming, assertions, mock usage, table-driven patterns, and common pitfalls.
1writing-go-code
Apply Go coding standards when writing or modifying Go code. Use when implementing functions, using dependency injection, handling errors idiomatically, or working with interfaces. For test conventions, use the `writing-go-tests` skill instead.
1testing-go-code
Run Go unit tests, coverage reports, and benchmarks. Use when you need to run tests, check coverage, run benchmarks, or regenerate mocks after interface changes.
1