e52870480d434002b17d40603733cf1b1bb7d98e
- Added context-aware server initialization in cmd/server/main.go - Implemented graceful shutdown handling with SIGINT/SIGTERM signals - Added 30-second shutdown timeout for active connections - Updated Greet service to use context.Context as first parameter - Enhanced Zerolog integration with Trace level logging - Added context-aware logging in Greet function calls - Fixed route structure to use /api/v1/greet/* prefix - Updated all handlers and tests to use context - Comprehensive AGENTS.md documentation with verified commands - Added server context management architecture section - Updated API endpoint documentation with working examples Changes: - cmd/server/main.go: Complete rewrite with context and graceful shutdown - pkg/greet/greet.go: Added context parameter and trace logging - pkg/greet/api_v1.go: Updated interface and handlers for context - pkg/greet/greet_test.go: Updated tests to use context - cmd/greet/main.go: Updated CLI to use context - pkg/server/server.go: Trace level config and context logging - AGENTS.md: Comprehensive documentation update - go.mod/go.sum: Added Zerolog dependency All tests passing, server working with graceful shutdown verified.
DanceLessonsCoach
A simple Go project demonstrating idiomatic package structure and CLI implementation.
Features
- Greet function with default behavior
- Command-line interface
- Unit tests
- Go 1.26.1 compatible
Installation
# Clone the repository
git clone https://github.com/yourusername/DanceLessonsCoach.git
cd DanceLessonsCoach
# Build and run
go run ./cmd/greet
Usage
# Default greeting
go run ./cmd/greet
# Output: Hello world!
# Custom greeting
go run ./cmd/greet John
# Output: Hello John!
Testing
# Run all tests
go test ./...
# Run specific package tests
go test ./pkg/greet/
Project Structure
DanceLessonsCoach/
├── cmd/
│ └── greet/
│ └── main.go # CLI entry point
├── pkg/
│ └── greet/
│ ├── greet.go # Core library
│ └── greet_test.go # Unit tests
├── go.mod # Go module definition
└── README.md # Project documentation
License
MIT
Description
Languages
Go
71.2%
Shell
21.7%
Gherkin
3.9%
TypeScript
1.4%
Vue
0.5%
Other
1.2%