gokit

module
v0.0.0-...-ae1a02b Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 22, 2026 License: MIT

README

gokit

中文

Go Report Card MIT License Go Reference

gokit is a Go language toolkit for production-ready services. Modular, type-safe, and thoroughly tested.

Features

  • Modular - Import only what you need
  • Type-safe - Full Go generics support (Go 1.23+)
  • Production-ready - battle-tested in production environments
  • DI-first - Built-in dependency injection with uber/fx

Installation

go get github.com/haysons/gokit

Quick Start

// Config with hot reload
cfg := config.New[AppConfig]()
cfg.SetFile("./config.yaml")
cfg.Load()

// Structured logging
logger := log.GetDefaultSlog()
logger.Info("server started", "port", 8080)

// Enhanced errors
err := errors.Wrap(dbErr, "database connection failed")
if errors.IsNotFound(err) { /* handle */ }

Modules

Module Description
app Application lifecycle with uber/fx
config Viper-based config with hot reload
log slog-based structured logging
errors Business codes + stack trace + hints
middleware HTTP/gRPC middleware (auth, logging, tracing)
transport Unified HTTP/gRPC transport layer
distributed etcd-based: lock, election, queue, counter
metadata Context metadata for RPC
util crypto, uid, hash, slices, maps...

Project Structure

gokit/
├── app/            # Application framework
├── config/         # Configuration management
├── distributed/    # Distributed tools (etcd)
├── errors/         # Error handling
├── log/            # Structured logging
├── middleware/    # HTTP/gRPC middleware
├── transport/     # Transport layer
├── metadata/      # Context metadata
├── constraints/   # Generics
└── util/          # Utility functions

License

MIT License - see LICENSE for details.


Made with ❤️ by @haysons

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL