做一次小小的备份,等会又删掉了
This commit is contained in:
@@ -37,20 +37,43 @@
|
||||
- [ ] All HTTP operations use Fiber framework
|
||||
- [ ] All database operations use GORM
|
||||
- [ ] All async tasks use Asynq
|
||||
- [ ] Uses Go official toolchain: `go fmt`, `go vet`, `golangci-lint`
|
||||
- [ ] Uses Go Modules for dependency management
|
||||
|
||||
**Code Quality Standards**:
|
||||
- [ ] Follows Handler → Service → Store → Model architecture
|
||||
- [ ] Handler layer only handles HTTP, no business logic
|
||||
- [ ] Service layer contains business logic with cross-module support
|
||||
- [ ] Store layer manages all data access with transaction support
|
||||
- [ ] Uses dependency injection via Service/Store structs
|
||||
- [ ] Uses dependency injection via struct fields (not constructor patterns)
|
||||
- [ ] Unified error codes in `pkg/errors/`
|
||||
- [ ] Unified API responses via `pkg/response/`
|
||||
- [ ] All constants defined in `pkg/constants/`
|
||||
- [ ] All Redis keys managed via key generation functions (no hardcoded strings)
|
||||
- [ ] All exported functions/types have Go-style doc comments
|
||||
- [ ] Code formatted with `gofmt`
|
||||
- [ ] Follows Effective Go and Go Code Review Comments
|
||||
|
||||
**Go Idiomatic Design**:
|
||||
- [ ] Package structure is flat (max 2-3 levels), organized by feature
|
||||
- [ ] Interfaces are small (1-3 methods), defined at use site
|
||||
- [ ] No Java-style patterns: no I-prefix, no Impl-suffix, no getters/setters
|
||||
- [ ] Error handling is explicit (return errors, no panic/recover abuse)
|
||||
- [ ] Uses composition over inheritance
|
||||
- [ ] Uses goroutines and channels (not thread pools)
|
||||
- [ ] Uses `context.Context` for cancellation and timeouts
|
||||
- [ ] Naming follows Go conventions: short receivers, consistent abbreviations (URL, ID, HTTP)
|
||||
- [ ] No Hungarian notation or type prefixes
|
||||
- [ ] Simple constructors (New/NewXxx), no Builder pattern unless necessary
|
||||
|
||||
**Testing Standards**:
|
||||
- [ ] Unit tests for all core business logic (Service layer)
|
||||
- [ ] Integration tests for all API endpoints
|
||||
- [ ] Tests use Go standard testing framework
|
||||
- [ ] Test files named `*_test.go` in same directory
|
||||
- [ ] Test functions use `Test` prefix, benchmarks use `Benchmark` prefix
|
||||
- [ ] Table-driven tests for multiple test cases
|
||||
- [ ] Test helpers marked with `t.Helper()`
|
||||
- [ ] Tests are independent (no external service dependencies)
|
||||
- [ ] Target coverage: 70%+ overall, 90%+ for core business
|
||||
|
||||
@@ -69,6 +92,9 @@
|
||||
- [ ] List queries implement pagination (default 20, max 100)
|
||||
- [ ] Non-realtime operations use async tasks
|
||||
- [ ] Database and Redis connection pools properly configured
|
||||
- [ ] Uses goroutines/channels for concurrency (not thread pools)
|
||||
- [ ] Uses `context.Context` for timeout control
|
||||
- [ ] Uses `sync.Pool` for frequently allocated objects
|
||||
|
||||
## Project Structure
|
||||
|
||||
|
||||
Reference in New Issue
Block a user