Releases: rameshsunkara/go-rest-api-example
Add Go 1.25 Flight Recorder Integration for Performance Debugging
Release Notes - v2.1.0 🚀
Release Date: November 10, 2025
🎉 What's New
Go 1.25 Flight Recorder Integration
The biggest feature in this release is the integration of Go 1.25's Flight Recorder for automatic performance tracing. This powerful diagnostic tool helps you debug production performance issues without any code changes.
Key Capabilities
✅ Automatic Slow Request Detection - Captures execution traces for requests taking > 500ms
✅ Zero Overhead When Disabled - Production-safe with opt-in configuration
✅ Visual Trace Analysis - Use go tool trace to debug performance bottlenecks
✅ Smart Buffer Management - Rolling 1 MiB buffer with 1-second retention window
Go 1.25 Upgrade
- Upgraded from Go 1.24 → Go 1.25
- Updated all dependencies to latest stable versions
- Enhanced CI/CD pipeline for Go 1.25 support
Enhanced Developer Experience
New Commands
make trace TRACE_FILE=./traces/slow-request-GET-orders-1234567890.traceBetter Documentation
- 🎨 Enhanced README with emojis and visual improvements
- 📚 Collapsible sections for better readability
- 📋 Added
.env.exampletemplate
Improved Configuration
- New
enableTracingenvironment variable
📦 What's Included
New Components
| Component | Description |
|---|---|
pkg/flightrecorder |
Flight recorder package with clean API |
.env.example |
Environment configuration template |
make trace |
Trace analysis command |
🔧 Configuration
New Environment Variables
# Enable flight recorder for slow request tracing
enableTracing=true # Default: falseTrace Configuration
- Threshold: 500ms (requests slower than this are traced)
- Buffer Size: 1 MiB (rolling buffer)
- Retention: 1 second (minimum trace age)
- Output Directory:
./traces/
📊 Performance Impact
| Mode | Memory Overhead | CPU Overhead | Notes |
|---|---|---|---|
| Disabled | 0 bytes | 0% | Default, production-safe |
| Enabled | ~1 MiB | ~1-2% | Rolling buffer, minimal impact |
| Capturing | +file size | Negligible | Non-blocking write |
🚀 Getting Started
Quick Start
# 1. Pull latest changes
git pull origin main
# 2. Update dependencies
go mod tidy
# 3. Copy environment template
cp .env.example .env
# 4. Enable tracing (optional)
echo "enableTracing=true" >> .env
# 5. Start the application
make startAnalyzing Traces
# Application automatically captures slow requests
# Traces are saved to ./traces/
# List available traces
ls -lhtr ./traces/
# Analyze a trace
make trace TRACE_FILE=./traces/slow-request-GET-orders-1762824976.trace🔄 Migration Guide
Upgrading from v1.x
This release is backward compatible with no breaking changes.
Automatic Migration
git pull origin main
go mod tidy
make start # Works immediately!Optional: Enable Tracing
# Add to .env file
enableTracing=trueDocker Users
# Rebuild with Go 1.25
docker-compose down
docker-compose build
docker-compose up -dCI/CD
- ✅ Updated to Go 1.25
- ✅ golangci-lint v2.6.2 (latest stable)
🔐 Security
- No security vulnerabilities introduced
- Flight recorder only active when explicitly enabled
- Trace files contain execution data (review before sharing)
- Added
.envto.gitignore(prevents credential leaks)
📖 Learning Resources
💬 Feedback
I love to hear your feedback!
- 🐛 Found a bug? Open an issue
- 💡 Have an idea? Start a discussion
- ⭐ Like this release? Give us a star!
MongoDB Connection Architecture Refactor
🚀 🚀 Release Notes - MongoDB Connection Architecture Refactor
📋 Overview
This release represents a major architectural overhaul focused on MongoDB connection management, dependency upgrades, code organization improvements, and comprehensive test coverage enhancement. The changes improve maintainability, reliability, and follow Go best practices.
✨ Major Features & Improvements
🔧 MongoDB Connection Architecture Redesign
- Complete refactor of MongoDB connection management from
internal/dbto dedicatedpkg/mongodbpackage - New modular connection system with support for:
- MongoDB and MongoDB+SRV connection schemes
- Configurable options using functional pattern (replica sets, read preferences, write concerns)
- Credential management via sidecar files
- Connection URL masking for security
- Comprehensive connection validation and error handling
📦 Package Restructuring & Clean Architecture
- Migrated logger from
internal/loggertopkg/loggerfor better reusability - Extracted configuration management to dedicated
internal/configpackage - Improved separation of concerns with cleaner package boundaries
🏗️ Server & Application Improvements
- Enhanced graceful shutdown with proper context cancellation handling
- Improved server lifecycle management with better error handling
- Streamlined main application logic with cleaner separation of setup phases
- Better configuration loading and validation
🔄 Dependency Updates
- MongoDB Driver 1.17.4 (latest stable release)
- Gin Framework 1.11.0 (latest version with security fixes)
- Updated all dependencies to latest stable versions for security and performance
🛠️ Technical Changes
New Packages & Components
pkg/mongodb/ # MongoDB connection management
├── connection.go # Connection manager implementation
├── options.go # Connection options and functional patterns
├── types.go # Type definitions and credentials
└── url.go # Connection URL building and validation
pkg/logger/ # Structured logging with zerolog
├── logger.go # Logger interface and implementation
└── logger_test.go # Comprehensive logger tests
internal/config/ # Configuration management
├── config.go # Environment configuration loading
└── config_test.go # Configuration validation tests
Removed/Refactored Components
- ❌
internal/db/connection.go→ ✅pkg/mongodb/connection.go - ❌
internal/db/connectionURL.go→ ✅pkg/mongodb/url.go - ❌
internal/logger/→ ✅pkg/logger/ - ❌
internal/util/→ ✅internal/utilities/
🔒 Security Enhancements
- Input validation for all MongoDB connection parameters
- Updated dependencies with latest security patches
🚀 DevOps & CI/CD Improvements
- Enhanced Makefile with comprehensive test coverage reporting
- Improved Docker configuration for local development
- VS Code workspace settings for consistent development experience
🐛 Bug Fixes & Stability
- Improved error handling with proper error wrapping and context
- Enhanced graceful shutdown preventing resource leaks
🔄 Breaking Changes
- MongoDB connection interfaces moved from
internal/dbtopkg/mongodb - Logger interface relocated to
pkg/logger - Configuration structure updated in
internal/config
🎯 Migration Guide
For developers working with the codebase:
-
Import path updates for MongoDB connections:
// Old import "github.com/rameshsunkara/go-rest-api-example/internal/db" // New import "github.com/rameshsunkara/go-rest-api-example/pkg/mongodb"
-
Logger import changes:
// Old import "github.com/rameshsunkara/go-rest-api-example/internal/logger" // New import "github.com/rameshsunkara/go-rest-api-example/pkg/logger"
v1.1.1 Auto detect race conditions
Code changes are here: #57
Fixes panic in tests:
Removes redundant t.Parallel() calls at the top level of test functions that use subtests, ensuring t.Parallel() is only called within subtest closures. This prevents the panic: testing: t.Parallel called multiple times error.
Test structure improvements:
Refactors table-driven tests to use proper parallelization patterns, increasing test isolation and reliability.
General test cleanup:
Ensures consistent error handling and assertion usage across test files.
Fixes race conditions and panics in tests caused by improper use of t.Parallel().
Improves test maintainability and reliability.
In addition to test changes
- Injects logger to all appropriate functions
- main.go is now modular and readable
- Removed deferrun dep which was dealing with signals to cleanup
v1.1.0
Changes in this release:
- Upgraded Go version to 1.24: Updated the project to use the latest stable version of Go, ensuring better performance, security, and access to new language features.
- Upgraded golangci-lint to v2: Integrated the latest version of golangci-lint (v2), improving static code analysis and linting capabilities to catch potential issues early.
- Optimized Dockerfile with BuildKit: The Dockerfile now leverages Docker BuildKit for more efficient builds, including enhanced caching and faster layer processing.
- Parallelized Build Workflow: The CI build pipeline has been updated to run tests and Docker builds in parallel, reducing build time and improving overall workflow efficiency.
This release focuses on performance improvements, build optimizations, and code quality enhancements.
Full Changelog: v1.0.1...v1.1.0
Makefile and Test execution improvements
- Updated Makefile to improve readability and maintainability
- Got rid of in memory mongodb usage for db test and used mtest from offical mongodb.
- Tests are now executed in parallel
- Updated redme to improve readbility
- Increased code coverage
v1.0.0 New features
Following are the newly added features
API Features:
- OWASP Compliant Open API 3 Spec
- Middleware for
- Logging : Helps in debugging and monitoring
- Authentication : Placeholder for different authentication mechanisms
- Tracing by Request ID : Helps in debugging
- Panic Recovery : Helps in keeping the service up
- Common Security Headers : Keeps the service secure
- Query Params Validation : Helps in keeping the service secure
- Standard Error Handling
- All errors are handled and returned in a standard format
- Versioning
- Model Management
- Generally, the data model used internally is different from the data model exposed to the client.
This helps in keeping the internal model separate from the exposed model.
- Generally, the data model used internally is different from the data model exposed to the client.
Go Application Features:
- Configuration Management through Environment Variables
- A Makefile to do all common tasks
- A Git Action to build, run tests, generate code coverage
- Integrated GO Formatter and Linter
- Mechanism to load secrets from Sidecar
- Enables connecting to multiple databases
- Follows the best practices for connecting to MongoDB
- Good mocking practises for Unit test patterns
- Standard filename conventions for better readability