🛠️ Go Universal Toolkit - A feature-rich, high-performance Go toolkit collection that provides simple, efficient, and practical tool modules to help developers quickly build high-quality projects.
✨ Features
- 🚀 High Performance: Performance-optimized implementations
- 🧩 Modular Design: Independent modules, use as needed
- 🔧 Easy to Use: Simple API design, quick to get started
- 🛡️ Type Safe: Full utilization of Go's type system
- 📦 Zero Dependencies: Most modules have no external dependencies
- 🔄 Actively Maintained: Active development and maintenance
📦 Installation
# Latest version (recommended) go get github.com/Rehtt/Kit@latest # Compatible with older Go versions go get github.com/Rehtt/Kit@go1.17
Requirements: Go 1.21+ (recommended) or Go 1.17+
🚀 Quick Start
Web Server Example
package main import ( "fmt" "github.com/Rehtt/Kit/web" "net/http" ) func main() { // Create web instance app := web.New() // Route definition app.Get("/hello/:name", func(ctx *web.Context) { name := ctx.GetUrlPathParam("name") ctx.JSON(200, map[string]string{ "message": fmt.Sprintf("Hello, %s!", name), "status": "success", }) }) // Middleware support app.Use(func(ctx *web.Context) { ctx.Writer.Header().Set("X-Powered-By", "Kit") ctx.Next() }) // Start server fmt.Println("Server starting on :8080") http.ListenAndServe(":8080", app) }
Logging Example
package main import "github.com/Rehtt/Kit/log" func main() { // Basic logging log.Info("Application started") log.Error("Error occurred", "error", err) // Structured logging log.With("user_id", 123).Info("User logged in") }
Cache Example
package main import ( "github.com/Rehtt/Kit/cache" "time" ) func main() { // Create cache instance c := cache.New() // Set cache c.Set("key", "value", 5*time.Minute) // Get cache if value, ok := c.Get("key"); ok { fmt.Println("Cache value:", value) } }
🧩 Module Overview
Kit contains multiple independent modules that you can use as needed:
Core Modules
| Module | Description | Features |
|---|---|---|
| web | Lightweight web framework | Routing, middleware, JSON support |
| log | High-performance logging library | Structured logging, multiple levels, high performance |
| cache | Universal cache interface | In-memory cache, TTL support |
| db | Database tools | Condition building, query construction |
| http | HTTP client | Request wrapper, retry mechanism |
Utility Modules
| Module | Description | Features |
|---|---|---|
| file | File operation tools | File I/O, path handling |
| strings | String utilities | High-performance conversion, string processing |
| random | Random number generation | Random strings, number generation |
| util | General utilities | Snowflake ID, time tools |
| struct | Struct tools | Comparison, tag reading, conversion |
Data Structure Modules
| Module | Description | Features |
|---|---|---|
| maps | Thread-safe Map | Concurrent safe, high performance |
| queue | Queue implementation | Multiple queue types |
| slice | Slice utilities | Slice operations, functional programming |
| heap | Heap data structure | Priority queue, heap sort |
| expiredMap | Expiring Map | Auto expiration, memory management |
Network & System Modules
| Module | Description | Features |
|---|---|---|
| net | Network tools | Network detection, IP processing |
| host | Host information | System info retrieval |
| browser | Browser tools | Browser launch, control |
| wireguard | WireGuard tools | VPN configuration, management |
Other Utility Modules
| Module | Description | Features |
|---|---|---|
| i18n | Internationalization support | Multi-language, localization |
| yaml | YAML processing | Configuration file parsing |
| cli | Command line tools | CLI application building |
| generate | Code generation | Template generation, code generation |
| vt | Virtual terminal | Terminal control, color output |
| multiplex | Multiplexing | Connection multiplexing, load balancing |
📖 Documentation
Each module has detailed documentation and examples. Visit the corresponding module directory:
🛠️ Development Guide
Requirements
- Go 1.21+ (recommended)
- Git
Local Development
# Clone the project git clone https://github.com/Rehtt/Kit.git cd Kit # Run tests go test ./... # Build project go build ./...
Code Standards
- Follow Go official code standards
- Use
gofmtto format code - Write unit tests
- Add necessary documentation comments
🤝 Contributing
We welcome and appreciate all forms of contributions!
How to Contribute
- 🍴 Fork this project
- 🔧 Create a feature branch (
git checkout -b feature/amazing-feature) - 💾 Commit your changes (
git commit -m 'Add some amazing feature') - 📤 Push to the branch (
git push origin feature/amazing-feature) - 🔄 Create a Pull Request
Contribution Guidelines
- Submit Issues to report bugs or suggest new features
- Create Pull Requests to contribute code
- Improve documentation and examples
- Share usage experiences and best practices
📊 Project Status
- ✅ Actively Maintained: Regular updates and maintenance
- 🔄 Continuous Integration: Automated testing and building
- 📈 Continuous Improvement: Ongoing optimization based on community feedback
- 🛡️ Stable & Reliable: Proven in production environments
🙏 Acknowledgments
Thanks to all developers who have contributed to the Kit project!
📄 License
This project is open source under the MIT License.
If this project helps you, please give us a ⭐️ Star!
Made with ❤️ by Rehtt