golang-conventions
Installation
SKILL.md
Go Coding Conventions
Quick Reference
- Go version: Use Go 1.21+ for modern features (generics, slices package, cmp)
- Formatting: Use
gofmtandgoimports(automatic via gopls) - Linting: Use
golangci-lintwith comprehensive linters enabled - Testing: Table-driven tests, test fixtures, subtests with
t.Run() - Error handling: Explicit, descriptive errors with
errors.Is()anderrors.As()
Core Principles
1. Simplicity and Clarity
- Write clear, idiomatic Go code
- Prefer simple solutions over clever ones
- Follow the principle of least surprise
- "Clear is better than clever" - Go Proverbs