Go Development Patterns
When to Use
- Building Go services or CLI applications
- Implementing job scheduling or task orchestration
- Integrating with Docker API
- Building LDAP/Active Directory clients
- Designing resilient systems with retry logic
- Setting up comprehensive test suites
Required Workflow
For comprehensive reviews, ALWAYS invoke these related skills:
- Security audit - Invoke
/netresearch-skills-bundle:security-audit for OWASP analysis, vulnerability assessment, and security patterns
- Enterprise readiness - Invoke
/netresearch-skills-bundle:enterprise-readiness for OpenSSF Scorecard, SLSA compliance, supply chain security
- GitHub project setup - Invoke
/netresearch-skills-bundle:github-project for branch protection, rulesets, CI workflow validation
A Go development review is NOT complete until all related skills have been executed.
Core Principles
Type Safety
- Avoid:
interface{}, sync.Map, scattered type assertions, reflection
- Prefer: Generics
[T any], concrete types, compile-time verification
Consistency
- One pattern per problem domain
- Match existing codebase patterns
- Refactor holistically or not at all
Conventions
- Errors: lowercase, no punctuation (
errors.New("invalid input"))
- Naming: ID, URL, HTTP (not Id, Url, Http)
- Error wrapping:
fmt.Errorf("failed to process: %w", err)
References
Load these as needed for detailed patterns and examples:
| Reference |
Purpose |
references/architecture.md |
Package structure, config management, middleware chains |
references/resilience.md |
Retry logic, graceful shutdown, context propagation |
references/docker.md |
Docker client patterns, buffer pooling |
references/ldap.md |
LDAP/Active Directory integration |
references/testing.md |
Test strategies, build tags, table-driven tests |
references/linting.md |
golangci-lint v2, staticcheck, code quality |
references/api-design.md |
Bitmask options, functional options, builders |
references/fuzz-testing.md |
Go fuzzing patterns, security seeds |
references/mutation-testing.md |
Gremlins configuration, test quality measurement |
references/makefile.md |
Standard Makefile interface for CI/CD |
Quality Gates
Run these checks before completing any review:
golangci-lint run --timeout 5m # Linting
go vet ./... # Static analysis
staticcheck ./... # Additional checks
govulncheck ./... # Vulnerability scan
go test -race ./... # Race detection
Contributing: Submit improvements to https://github.com/netresearch/go-development-skill
1---2name: go-development3description: Production-grade Go development patterns for building resilient services. Use when developing Go applications, implementing job schedulers, Docker integrations, LDAP clients, or needing patterns for resilience, testing, and performance optimization. By Netresearch.4---5
6# Go Development Patterns
7
8## When to Use
9
10- Building Go services or CLI applications
11- Implementing job scheduling or task orchestration
12- Integrating with Docker API
13- Building LDAP/Active Directory clients
14- Designing resilient systems with retry logic
15- Setting up comprehensive test suites
16
17## Required Workflow
18
19**For comprehensive reviews, ALWAYS invoke these related skills:**
20
211. **Security audit** - Invoke `/netresearch-skills-bundle:security-audit` for OWASP analysis, vulnerability assessment, and security patterns
222. **Enterprise readiness** - Invoke `/netresearch-skills-bundle:enterprise-readiness` for OpenSSF Scorecard, SLSA compliance, supply chain security
233. **GitHub project setup** - Invoke `/netresearch-skills-bundle:github-project` for branch protection, rulesets, CI workflow validation
24
25A Go development review is NOT complete until all related skills have been executed.
26
27## Core Principles
28
29### Type Safety
30
31- **Avoid:** `interface{}`, `sync.Map`, scattered type assertions, reflection
32- **Prefer:** Generics `[T any]`, concrete types, compile-time verification
33
34### Consistency
35
36- One pattern per problem domain
37- Match existing codebase patterns
38- Refactor holistically or not at all
39
40### Conventions
41
42- Errors: lowercase, no punctuation (`errors.New("invalid input")`)
43- Naming: ID, URL, HTTP (not Id, Url, Http)
44- Error wrapping: `fmt.Errorf("failed to process: %w", err)`
45
46## References
47
48Load these as needed for detailed patterns and examples:
49
50| Reference | Purpose |
51|-----------|---------|
52| `references/architecture.md` | Package structure, config management, middleware chains |
53| `references/resilience.md` | Retry logic, graceful shutdown, context propagation |
54| `references/docker.md` | Docker client patterns, buffer pooling |
55| `references/ldap.md` | LDAP/Active Directory integration |
56| `references/testing.md` | Test strategies, build tags, table-driven tests |
57| `references/linting.md` | golangci-lint v2, staticcheck, code quality |
58| `references/api-design.md` | Bitmask options, functional options, builders |
59| `references/fuzz-testing.md` | Go fuzzing patterns, security seeds |
60| `references/mutation-testing.md` | Gremlins configuration, test quality measurement |
61| `references/makefile.md` | Standard Makefile interface for CI/CD |
62
63## Quality Gates
64
65Run these checks before completing any review:
66
67```bash
68golangci-lint run --timeout 5m # Linting
69go vet ./... # Static analysis
70staticcheck ./... # Additional checks
71govulncheck ./... # Vulnerability scan
72go test -race ./... # Race detection
73```
74
75---
76
77> **Contributing:** Submit improvements to https://github.com/netresearch/go-development-skill