golib

module
v1.19.2 Latest Latest
Warning

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

Go to latest
Published: Feb 4, 2026 License: MIT

README ΒΆ

golib

Go Version Go GoDoc Go Report Card Known Vulnerabilities Tests Coverage

Comprehensive Go library collection providing production-ready packages for cloud services, web infrastructure, data management, security, monitoring, and development utilities. Built for enterprise-grade applications with extensive testing and documentation.


Table of Contents


Overview

golib is a comprehensive collection of production-ready Go packages designed to accelerate enterprise application development. Each package is independently usable, thoroughly tested, and follows Go best practices with a focus on performance, thread safety, and observability.

This library provides building blocks for cloud-native applications, web services, data processing, secure communications, production operations, and development productivity.

Design Philosophy
  1. Modularity: Self-contained packages with minimal cross-dependencies
  2. Production-Ready: Comprehensive testing with 11,818 specs across 131 packages
  3. Performance-First: Streaming operations, zero-allocation paths, optimized throughput
  4. Thread-Safe: All concurrent operations validated with race detector
  5. Observable: Structured logging, Prometheus metrics, health checks, monitoring
  6. Standards-Compliant: Go idioms, semantic versioning, standard library interfaces
Repository Statistics
Total Packages:       165 (131 with tests, 34 utility/types packages)
Documented Packages:  62 packages with individual README.md files
Test Specifications:  11,818
Test Assertions:      23,080
Benchmarks:           151
Pending Tests:        18
Skipped Tests:        6
Average Coverage:     75.49%
Packages β‰₯80%:        71/131 (54.2%)
Packages β‰₯90%:        43/131 (32.8%)
Go Version:           1.24+ (1.25+ recommended)
Platforms:            Linux, macOS, Windows
Thread Safety:        βœ… Zero race conditions
CI/CD:                GitHub Actions with race detection

Key Features

🌩️ Cloud & Infrastructure
  • AWS Integration: S3 storage, IAM management, MinIO compatibility (aws)
  • Artifact Management: GitHub, GitLab, JFrog Artifactory, S3 artifact handling (artifact)
  • Archive & Compression: Streaming TAR/ZIP with GZIP, BZIP2, LZ4, XZ support (archive)
🌐 Web & Networking
  • HTTP Server: Pool management with TLS, multi-handler, monitoring, graceful shutdown (httpserver)
  • HTTP Client: Advanced client with DNS mapping, retries, timeouts (httpcli)
  • Router: Gin-based routing with auth headers, CORS, request validation (router)
  • Socket Communication: TCP, UDP, Unix domain socket servers and clients (socket)
πŸ’Ύ Data Management
  • I/O Utilities: Stream aggregation, multiplexing, progress tracking, delimiters (ioutils)
  • Database: GORM integration for MySQL, PostgreSQL, SQLite, SQL Server (database)
  • Cache: In-memory cache with TTL, atomic operations, thread-safe (cache)
  • File Operations: Bandwidth control, progress tracking, permission management (file)
πŸ”’ Security & Communication
  • Certificates: TLS certificate management, CA operations, cipher suites (certificates)
  • Authentication: LDAP integration, OAuth clients, password generation (ldap, oauth, password)
  • Email: Complete SMTP solution with TLS/STARTTLS, templating, composition, queuing (mail)
  • FTP: FTP client with connection management (ftpclient)
πŸ“Š Monitoring & Logging
  • Structured Logging: Multi-output (file, syslog, stdout/stderr), field injection, rotation (logger)
  • Prometheus Metrics: Custom metrics, bloom filters, web metrics endpoints (prometheus)
  • Health Monitoring: System info, status checks, health endpoints (monitor)
  • Status Management: Component status tracking, mandatory checks, control (status)
πŸ› οΈ Utilities & Helpers
  • Error Management: Error codes, stack traces, hierarchies, thread-safe pools (errors)
  • Encoding: AES encryption, SHA256 hashing, hex encoding, remote random reader for HSM (encoding)
  • Type Utilities: Semantic versioning, byte sizes, extended duration with days, protocols (version, size, duration, network)
  • Configuration: Component lifecycle orchestration with hot-reload (config, viper), version-aware serialization (retro)
⚑ Concurrency & Control
  • Atomic Types: Type-safe atomic primitives with default values and type casting (atomic)
  • Semaphores: Weighted semaphores, WaitGroups with progress tracking (semaphore)
  • Lifecycle: Start/Stop patterns, ticker management, context control (runner)
  • Context: Gin context wrappers, enhanced context utilities (context)
πŸ§ͺ Development Tools
  • CLI Framework: Cobra extensions with enhanced features (cobra)
  • Shell: Interactive shell with command management, TTY handling (shell)
  • Console: Terminal formatting, colored output, progress indicators (console)
  • Static File Server: Secure static file serving with WAF/IDS/EDR integration, rate limiting, path security (static)

Architecture

Package Organization

The library is organized into 37 top-level packages, each focused on a specific domain:

golib/
β”œβ”€β”€ Cloud & Infrastructure
β”‚   β”œβ”€β”€ archive/              Archive & compression (TAR, ZIP, GZIP, BZIP2, LZ4, XZ)
β”‚   β”œβ”€β”€ artifact/             Artifact management (GitHub, GitLab, JFrog, S3)
β”‚   └── aws/                  AWS SDK integration (S3, IAM, MinIO)
β”‚
β”œβ”€β”€ Web & Networking
β”‚   β”œβ”€β”€ httpcli/              Advanced HTTP client with DNS mapping
β”‚   β”œβ”€β”€ httpserver/           HTTP/HTTPS server pool with TLS and multi-handler
β”‚   β”œβ”€β”€ router/               Gin-based router with auth and middleware
β”‚   └── socket/               TCP/UDP/Unix socket servers and clients
β”‚
β”œβ”€β”€ Data Management
β”‚   β”œβ”€β”€ cache/                In-memory cache with TTL
β”‚   β”œβ”€β”€ database/             GORM integration and key-value stores
β”‚   β”œβ”€β”€ file/                 File operations with progress tracking
β”‚   └── ioutils/              I/O utilities (aggregation, multiplexing, delimiters)
β”‚
β”œβ”€β”€ Security & Communication
β”‚   β”œβ”€β”€ certificates/         TLS certificate management
β”‚   β”œβ”€β”€ ftpclient/            FTP client
β”‚   β”œβ”€β”€ ldap/                 LDAP authentication
β”‚   β”œβ”€β”€ mail/                 Complete SMTP with TLS/STARTTLS, templating, queuing
β”‚   β”œβ”€β”€ nats/                 NATS messaging
β”‚   β”œβ”€β”€ oauth/                OAuth clients
β”‚   └── password/             Password generation
β”‚
β”œβ”€β”€ Monitoring & Logging
β”‚   β”œβ”€β”€ logger/               Structured logging with multiple outputs
β”‚   β”œβ”€β”€ monitor/              System monitoring and health checks
β”‚   β”œβ”€β”€ prometheus/           Prometheus metrics integration
β”‚   └── status/               Component status management
β”‚
β”œβ”€β”€ Utilities & Helpers
β”‚   β”œβ”€β”€ config/               Component lifecycle orchestration with hot-reload
β”‚   β”œβ”€β”€ duration/             Extended duration with days (1d=24h) and large ranges
β”‚   β”œβ”€β”€ encoding/             Encryption, hashing, remote random reader (HSM)
β”‚   β”œβ”€β”€ errors/               Advanced error management
β”‚   β”œβ”€β”€ network/              Network protocol utilities
β”‚   β”œβ”€β”€ retro/                Version-aware struct serialization
β”‚   β”œβ”€β”€ size/                 Byte size arithmetic
β”‚   β”œβ”€β”€ version/              Semantic versioning
β”‚   └── viper/                Viper configuration wrapper
β”‚
β”œβ”€β”€ Concurrency & Control
β”‚   β”œβ”€β”€ atomic/               Type-safe atomic primitives with defaults
β”‚   β”œβ”€β”€ context/              Enhanced context utilities
β”‚   β”œβ”€β”€ runner/               Lifecycle management (Start/Stop, Ticker)
β”‚   └── semaphore/            Weighted semaphores with WaitGroups and progress
β”‚
└── Development Tools
    β”œβ”€β”€ cobra/                Cobra CLI extensions
    β”œβ”€β”€ console/              Terminal formatting
    β”œβ”€β”€ pprof/                Profiling utilities
    β”œβ”€β”€ request/              HTTP request helpers
    β”œβ”€β”€ shell/                Interactive shell
    └── static/               Security-focused static file server with caching

Package Count: 37 top-level, 165 total (including subpackages)

Dependency Model
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚                    Application Layer                        β”‚
β”‚  (Your application imports specific golib packages)         β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                            β–Ό
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚                   High-Level Packages                       β”‚
β”‚  httpserver, router, config, monitor, mail, archive         β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                            β–Ό
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚                   Mid-Level Packages                        β”‚
β”‚  logger, errors, runner, status, database, httpcli          β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                            β–Ό
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚                   Low-Level Packages                        β”‚
β”‚  atomic, context, semaphore, ioutils, encoding              β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                            β–Ό
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚                   Foundation Packages                       β”‚
β”‚  version, size, duration, network, password                 β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                            β–Ό
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚                   Go Standard Library                       β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

Design Principles:

  • Layered Architecture: Clear separation between application, business, and infrastructure layers
  • Minimal Coupling: Packages depend on abstractions, not concrete implementations
  • Interface-Based: Most packages define interfaces for extensibility
  • Standard Library First: Leverage Go standard library where possible

Installation

Requirements
  • Go: 1.24 or higher (required for os.OpenRoot API)
  • Platform: Linux, macOS, or Windows
  • CGO: Optional (required for race detector during testing)
Quick Setup
# Install entire library
go get github.com/nabbar/golib

# Install specific packages
go get github.com/nabbar/golib/logger
go get github.com/nabbar/golib/archive
go get github.com/nabbar/golib/httpserver
go get github.com/nabbar/golib/errors
go get github.com/nabbar/golib/ioutils
Import in Your Project
package main

import (
    "github.com/nabbar/golib/logger"
    "github.com/nabbar/golib/errors"
    "github.com/nabbar/golib/httpserver"
)

func main() {
    // Use packages as needed
}
Updating
# Update all packages
go get -u github.com/nabbar/golib/...

# Update specific package
go get -u github.com/nabbar/golib/logger

Package Catalog

Detailed list of all packages with coverage statistics and links to documentation.

Total: 62 packages with individual README.md documentation across 165 Go packages.

Note: Many parent packages have multiple documented subpackages:

The table below lists all 165 Go packages with their test coverage and links to their 62 individual README.md documentation files.

Cloud & Infrastructure
Package Coverage Specs Description Documentation
archive 8.6% 89 Streaming archive and compression README
artifact 23.4% 19 Artifact management (GitHub/GitLab/JFrog/S3) README
artifact/client 98.6% 21 Generic artifact client interface -
aws 5.4% 220 AWS SDK integration (S3, IAM, MinIO) README
static 82.6% 229 Security-focused static file server with embed.FS, rate limiting, WAF integration README
Web & Networking
Package Coverage Specs Description Documentation
httpcli 71.4% 34 Advanced HTTP client with retries README
httpcli/dns-mapper 71.7% 26 DNS mapping for HTTP clients -
httpserver 52.5% 84 HTTP/HTTPS server pool management with TLS, monitoring and multi-handler support README
httpserver/pool 63.1% 78 Multi-server orchestration and pooling -
network 75.4% 162 Network utilities and protocol handling README
network/protocol 98.7% 298 Network protocol constants and helpers -
router 91.0% 61 Gin-based router with auth README
router/auth 96.3% 12 Authentication middleware -
router/authheader 100% 11 Authorization header parsing -
router/header 83.3% 29 HTTP header utilities -
socket No tests - Socket communication base README
socket/client No tests - Socket client base README
socket/client/tcp 74.0% 119 TCP client implementation -
socket/client/udp 72.8% 68 UDP client implementation -
socket/client/unix 76.3% 67 Unix domain socket client -
socket/client/unixgram 76.8% 65 Unix datagram socket client -
socket/server No tests - Socket server base README
socket/server/tcp 84.6% 117 TCP server implementation -
socket/server/udp 72.0% 18 UDP server implementation -
socket/server/unix 73.5% 23 Unix domain socket server -
socket/server/unixgram 70.8% 20 Unix datagram socket server -
Data Management
Package Coverage Specs Description Documentation
cache 96.7% 43 In-memory cache with TTL README
cache/item 96.7% 21 Cache item implementation -
database/gorm 19.6% 41 GORM integration README
database/kvdriver 38.4% 20 Key-value store driver -
database/kvitem 76.4% 33 Key-value item -
database/kvmap 66.7% 30 Key-value map -
database/kvtable 65.9% 24 Key-value table -
file/bandwidth 77.8% 25 Bandwidth-limited I/O README
file/perm 88.9% 141 File permission utilities -
file/progress 71.1% 90 File operation progress tracking -
ioutils 88.2% 31 I/O utilities base README
ioutils/aggregator 84.9% 115 Thread-safe write aggregator that buffers and serializes concurrent writes README
ioutils/bufferReadCloser 100% 44 Lightweight wrappers adding io.Closer to bytes.Buffer and bufio types README
ioutils/delim 98.6% 95 Delimiter-based stream processing README
ioutils/fileDescriptor 85.7% 28 Cross-platform file descriptor limit management README
ioutils/ioprogress 84.7% 54 I/O progress tracking README
ioutils/iowrapper 100% 88 Generic I/O wrappers README
ioutils/mapCloser 80.8% 82 Thread-safe, context-aware manager for multiple io.Closer instances README
ioutils/maxstdio No tests - Stdio limit management README
ioutils/multi 80.8% 112 Thread-safe adaptive multi-writer extending io.MultiWriter README
ioutils/nopwritecloser 100% 54 Wrapper implementing io.WriteCloser with no-op Close() README
Security & Communication
Package Coverage Specs Description Documentation
certificates 44.6% 2 TLS certificate management README
certificates/auth 73.0% 13 Certificate authentication -
certificates/ca 64.1% 17 Certificate authority operations -
certificates/certs 48.4% 2 Certificate utilities -
certificates/cipher 51.2% 6 Cipher suite management -
certificates/curves 51.6% 4 Elliptic curve management -
certificates/tlsversion 54.5% 4 TLS version utilities -
ftpclient 6.2% 22 FTP client implementation README
ldap No tests - LDAP authentication README
mail No tests - Complete email solution with SMTP (TLS/STARTTLS), templating, composition and queuing README
mail/queuer 90.8% 102 Email queuing with pooling README
mail/render 89.6% 123 Email template rendering README
mail/sender 81.4% 252 Email sending utilities README
mail/smtp 90.1% 104 SMTP client implementation README
mail/smtp/config 92.7% 222 SMTP configuration -
mail/smtp/tlsmode 98.8% 165 SMTP TLS mode handling -
nats No tests - NATS messaging client -
oauth No tests - OAuth client integration -
password 84.6% 6 Password generation README
Monitoring & Logging
Package Coverage Specs Description Documentation
logger 68.0% 81 Structured logging framework README
logger/config 85.3% 127 Logger configuration -
logger/entry 85.1% 119 Log entry management -
logger/fields 49.2% 49 Log field injection -
logger/gorm 100% 34 GORM logger integration -
logger/hashicorp 96.6% 89 Hashicorp logger adapter -
logger/hookfile 19.6% 22 File output hook -
logger/hookstderr 100% 30 Stderr output hook -
logger/hookstdout 100% 30 Stdout output hook -
logger/hooksyslog 53.5% 20 Syslog output hook -
logger/hookwriter 90.2% 31 Generic writer hook -
logger/level 65.9% 42 Log level management -
monitor 81.9% 103 System monitoring README
monitor/info 100% 95 System information collection README
monitor/pool 76.2% 153 Monitor pooling README
monitor/status 98.4% 181 Status reporting -
prometheus 60.0% 137 Prometheus metrics README
prometheus/bloom 94.7% 45 Bloom filter metrics -
prometheus/metrics 95.5% 179 Custom metrics -
prometheus/pool 72.5% 74 Prometheus pooling -
prometheus/types 100% 36 Prometheus type definitions -
prometheus/webmetrics No tests - Web metrics endpoint README
status 85.9% 120 Status management README
status/control 95.0% 102 Status control -
status/listmandatory 86.0% 29 Mandatory status list -
status/mandatory 76.1% 55 Mandatory status checks -
Utilities & Helpers
Package Coverage Specs Description Documentation
config 61.9% 93 Component lifecycle orchestration with dependency resolution and hot-reload README
config/components/aws 40.7% 183 AWS component config -
config/components/database 39.0% 196 Database component config -
config/components/head 84.6% 185 Header component config -
config/components/http 71.7% 257 HTTP component config -
config/components/httpcli 86.0% 137 HTTP client component config -
config/components/ldap 70.5% 90 LDAP component config -
config/components/log 88.0% 191 Logger component config -
config/components/mail 64.8% 68 Mail component config -
config/components/request 43.3% 35 Request component config -
config/components/smtp 51.5% 73 SMTP component config -
config/components/tls 82.1% 171 TLS component config -
duration 91.5% 179 Extended duration with days support (1d=24h) and arithmetic operations README
duration/big 91.0% 250 Large durations beyond time.Duration range (seconds precision, ~292B years) -
encoding No tests - Unified encoding interface with remote random reader for HSM operations README
encoding/aes 91.5% 126 AES encryption README
encoding/hexa 89.7% 97 Hexadecimal encoding README
encoding/mux 81.7% 59 Encoding multiplexer README
encoding/randRead 81.4% 32 Buffered random reader from remote sources (APIs, HSM) for cryptographic operations README
encoding/sha256 84.8% 61 SHA256 hashing README
errors 87.6% 222 Advanced error management README
errors/pool 100% 83 Error pool management -
retro 84.2% 156 Version-aware struct serialization for configuration evolution and backward compatibility README
size 95.4% 352 Byte size arithmetic README
version 93.8% 173 Semantic versioning README
viper 73.3% 104 Viper configuration wrapper README
Concurrency & Control
Package Coverage Specs Description Documentation
atomic 91.8% 49 Type-safe atomic primitives with default values and type casting helpers README
context 87.5% 80 Context utilities README
context/gin 76.9% 77 Gin context wrapper -
runner No tests - Lifecycle management base README
runner/startStop 88.8% 42 Start/Stop pattern -
runner/ticker 90.2% 88 Ticker management -
semaphore 97.4% 33 Weighted semaphores, WaitGroups and progress tracking with MPB integration README
semaphore/bar 96.6% 68 Semaphore with progress bar -
semaphore/sem 100% 66 Semaphore implementation -
Development Tools
Package Coverage Specs Description Documentation
cobra 76.7% 156 Cobra CLI extensions README
console 60.0% 182 Terminal formatting README
pprof No tests - Profiling utilities -
request No tests - HTTP request helpers -
shell 48.4% 120 Interactive shell README
shell/command 81.8% 93 Shell command management -
shell/tty 44.7% 126 TTY handling -

Quick Start

Logging
package main

import (
    "github.com/nabbar/golib/logger"
    "github.com/nabbar/golib/logger/level"
)

func main() {
    // Create logger with stdout output
    log := logger.New(nil)
    log.SetLevel(level.InfoLevel)
    
    // Basic logging
    log.Info("Application started")
    log.Error("An error occurred")
    
    // Structured logging with fields
    log.WithField("user", "john").Info("User logged in")
    log.WithFields(map[string]interface{}{
        "method": "GET",
        "path":   "/api/users",
        "status": 200,
    }).Info("Request processed")
}
HTTP Server
package main

import (
    "context"
    "github.com/nabbar/golib/httpserver"
    "github.com/nabbar/golib/logger"
)

func main() {
    log := logger.New(nil)
    
    // Create HTTP server
    srv := httpserver.New(context.Background(), log)
    srv.SetListenAddress(":8080")
    
    // Add routes
    srv.RegisterHandler("/", func(w http.ResponseWriter, r *http.Request) {
        w.Write([]byte("Hello, World!"))
    })
    
    // Start server
    if err := srv.Start(context.Background()); err != nil {
        log.Fatal(err)
    }
    defer srv.Stop()
    
    // Wait for interrupt
    select {}
}
Archive & Compression
package main

import (
    "github.com/nabbar/golib/archive"
    "os"
)

func main() {
    // Create tar.gz archive
    input, _ := os.Open("source-dir")
    output, _ := os.Create("archive.tar.gz")
    defer output.Close()
    
    // Stream compression
    if err := archive.Compress(input, output, "tar", "gzip"); err != nil {
        panic(err)
    }
    
    // Extract archive
    archiveFile, _ := os.Open("archive.tar.gz")
    if err := archive.Extract(archiveFile, "dest-dir"); err != nil {
        panic(err)
    }
}
Error Handling
package main

import (
    "github.com/nabbar/golib/errors"
)

func main() {
    // Create error with code
    err := errors.New("database connection failed").
        SetCode(500).
        AddParent(errors.New("network timeout"))
    
    // Check error
    if err != nil {
        // Get error code
        code := errors.GetCode(err)
        
        // Get full error chain
        chain := errors.GetParent(err)
        
        // Log with stack trace
        println(err.Error())
    }
}
Configuration
package main

import (
    "github.com/nabbar/golib/viper"
    "github.com/nabbar/golib/config"
)

func main() {
    // Load configuration from file
    cfg := viper.New()
    cfg.SetConfigFile("config.yaml")
    cfg.ReadInConfig()
    
    // Access configuration
    port := cfg.GetInt("server.port")
    host := cfg.GetString("server.host")
    
    println("Starting server on", host, ":", port)
}

Performance

Test Suite Metrics

Based on complete coverage analysis with coverage-report.sh:

Total Packages:       165
Packages with Tests:  127 (77.0%)
Packages without Tests: 38 (23.0%)

Test Specifications:  10,964
Test Assertions:      21,470
Benchmarks:           92
Pending Tests:        18

Execution Time:       Variable (cached results shown)
Race Conditions:      0 (verified with -race flag)
Coverage Analysis

Distribution by Coverage Level:

Coverage Range Count Percentage Package Examples
100% 14 11.0% errors/pool, logger/gorm, router/authheader, semaphore/sem
90-99% 24 18.9% atomic (91.8%), version (93.8%), size (95.4%)
80-89% 29 22.8% ioutils (88.2%), mail/queuer (90.8%), static (82.6%), context (87.5%)
70-79% 19 15.0% cobra (76.7%), viper (73.3%), file/bandwidth (77.8%)
60-69% 10 7.9% config (61.9%), logger (68.0%), database/kvmap (66.7%)
<60% 31 24.4% archive (8.6%), aws (5.4%), httpserver (52.5%)

Average Coverage: 73.9% (weighted across all 127 tested packages)

Performance Highlights

High-Performance Packages (>90% coverage):

  • atomic: 91.8% coverage, 49 specs - Generic atomic operations
  • mail/smtp/config: 92.7% coverage, 222 specs - SMTP configuration
  • version: 93.8% coverage, 173 specs - Semantic versioning
  • size: 95.4% coverage, 352 specs - Byte size arithmetic
  • prometheus/metrics: 95.5% coverage, 179 specs - Custom metrics

Well-Tested Core Packages:

  • ioutils: 90.4% average across 10 subpackages, 776 specs
  • mail: 89.0% average across 6 subpackages, 970 specs
  • logger: 74.7% base + 85%+ in config/entry, 573 specs
  • errors: 87.6% base + 100% pool, 305 specs
  • monitor: 88.5% base + 100% info, 572 specs

Packages Needing Improvement (<40% coverage):

  • archive (8.6%), aws (5.4%), artifact implementations
  • database/kvdriver (38.4%), config/components (39-43%)
  • ftpclient (6.2%), shell/tty (44.7%)

See TESTING.md for detailed test suite documentation.


Use Cases

1. Cloud-Native Microservices

Scenario: Build a microservice handling S3 uploads, monitoring, and structured logging.

import (
    "github.com/nabbar/golib/aws"
    "github.com/nabbar/golib/logger"
    "github.com/nabbar/golib/monitor"
    "github.com/nabbar/golib/prometheus"
)

// Microservice with full observability
type Service struct {
    storage    aws.Client
    log        logger.Logger
    monitor    monitor.Monitor
    metrics    prometheus.Registry
}

Packages Used: aws, logger, monitor, prometheus, httpserver

2. API Gateway with Advanced Routing

Scenario: HTTP API gateway with authentication, rate limiting, and request/response logging.

import (
    "github.com/nabbar/golib/router"
    "github.com/nabbar/golib/httpcli"
    "github.com/nabbar/golib/logger"
)

// Gateway with middleware stack
r := router.New()
r.Use(router.Auth())
r.Use(router.RateLimiter())
r.Use(router.Logging(log))

Packages Used: router, httpcli, logger, context, errors

3. Data Pipeline with Streaming

Scenario: ETL pipeline processing large archives with progress tracking and error handling.

import (
    "github.com/nabbar/golib/archive"
    "github.com/nabbar/golib/ioutils"
    "github.com/nabbar/golib/file/progress"
)

// Stream processing with progress
progress := ioprogress.NewReader(reader, func(n int64) {
    fmt.Printf("Processed: %d bytes\n", n)
})

archive.Extract(progress, destDir)

Packages Used: archive, ioutils, file, errors, logger

4. Distributed Task Queue

Scenario: Background job processing with concurrency control and monitoring.

import (
    "github.com/nabbar/golib/semaphore"
    "github.com/nabbar/golib/runner"
    "github.com/nabbar/golib/status"
)

// Concurrent task executor
sem := semaphore.New(maxWorkers)
for _, task := range tasks {
    sem.Acquire()
    go func(t Task) {
        defer sem.Release()
        processTask(t)
    }(task)
}

Packages Used: semaphore, runner, status, monitor, errors

5. Configuration Management System

Scenario: Multi-environment configuration with validation and hot-reload.

import (
    "github.com/nabbar/golib/config"
    "github.com/nabbar/golib/viper"
)

// Environment-aware config
cfg := config.New()
cfg.Load("config.yaml")
cfg.Watch() // Hot reload on file change

Packages Used: config, viper, logger, errors


Best Practices

βœ… DO

Use Structured Logging:

// βœ… GOOD: Structured fields for filtering/analysis
log.WithFields(map[string]interface{}{
    "user_id": userID,
    "action":  "login",
    "ip":      remoteAddr,
}).Info("User authentication")

// ❌ BAD: Unstructured string concatenation
log.Info("User " + userID + " logged in from " + remoteAddr)

Handle Errors Properly:

// βœ… GOOD: Error wrapping with context
if err != nil {
    return errors.New("database query failed").
        AddParent(err).
        SetCode(500)
}

// ❌ BAD: Ignoring errors
result, _ := database.Query()

Leverage Context for Cancellation:

// βœ… GOOD: Context-aware operations
ctx, cancel := context.WithTimeout(parent, 5*time.Second)
defer cancel()

if err := service.Process(ctx, data); err != nil {
    // Handle timeout or cancellation
}

// ❌ BAD: No cancellation support
service.Process(data)

Use Interfaces for Testing:

// βœ… GOOD: Interface-based dependencies
type UserService struct {
    storage Storage // interface
    logger  logger.Logger // interface
}

// ❌ BAD: Concrete dependencies
type UserService struct {
    storage *PostgresDB // concrete type
}

Stream Large Files:

// βœ… GOOD: Streaming with constant memory
reader := ioutils.NewReader(file)
writer := ioutils.NewWriter(dest)
io.Copy(writer, reader)

// ❌ BAD: Loading entire file into memory
data, _ := ioutil.ReadAll(file)
ioutil.WriteFile(dest, data, 0644)
❌ DON'T

Don't Ignore Resource Cleanup:

// ❌ BAD: No cleanup
file, _ := os.Open("data.txt")
data, _ := ioutil.ReadAll(file)

// βœ… GOOD: Proper cleanup
file, err := os.Open("data.txt")
if err != nil {
    return err
}
defer file.Close()

Don't Block Main Goroutine:

// ❌ BAD: Blocking indefinitely
server.Start()

// βœ… GOOD: Non-blocking with graceful shutdown
go server.Start()
<-ctx.Done()
server.Stop()

Don't Ignore Race Conditions:

// ❌ BAD: Shared state without synchronization
var counter int
for i := 0; i < 10; i++ {
    go func() { counter++ }()
}

// βœ… GOOD: Use atomic or mutex
var counter atomic.Int64
for i := 0; i < 10; i++ {
    go func() { counter.Add(1) }()
}

Don't Hardcode Configuration:

// ❌ BAD: Hardcoded values
db := sql.Open("postgres", "postgres://localhost:5432/db")

// βœ… GOOD: External configuration
cfg := config.Load()
db := sql.Open("postgres", cfg.GetString("database.url"))

Don't Skip Error Checking:

// ❌ BAD: Ignoring potential errors
json.Unmarshal(data, &result)

// βœ… GOOD: Always check errors
if err := json.Unmarshal(data, &result); err != nil {
    return errors.New("JSON parsing failed").AddParent(err)
}

Testing

Comprehensive test suite with 10,964 specifications across 127 packages.

See TESTING.md for detailed testing documentation.


Build Configuration

Build Tags

The library supports platform-specific builds using Go build tags:

# Build for specific architecture
go build -tags=386 ./...      # 32-bit
go build -tags=amd64 ./...    # 64-bit

# Platform-specific features
go build -tags=linux ./...
go build -tags=darwin ./...
go build -tags=windows ./...
Build Scripts

Two build helper scripts are provided:

  • build.386: Build for 32-bit architecture
  • build.amd64: Build for 64-bit architecture
# Use build scripts
./build.amd64
./build.386
Compile-Time Requirements
  • Go Version: 1.24+ (required for os.OpenRoot API introduced in Go 1.24)
  • CGO: Optional (needed for race detector: CGO_ENABLED=1)
  • Platform: Linux, macOS, Windows (some packages have platform-specific implementations)
Optimization Flags

Recommended build flags for production:

# Optimized production build
go build -ldflags="-s -w" -trimpath ./...

# With race detector (development only, significant performance impact)
CGO_ENABLED=1 go build -race ./...

# Static binary (Linux)
CGO_ENABLED=0 go build -ldflags="-s -w -extldflags '-static'" ./...
Cross-Compilation
# Linux from macOS
GOOS=linux GOARCH=amd64 go build ./...

# Windows from Linux
GOOS=windows GOARCH=amd64 go build ./...

# macOS from Linux
GOOS=darwin GOARCH=amd64 go build ./...

Contributing

Contributions are welcome! Please follow these guidelines:

  1. Code Quality

    • Follow Go best practices and idioms
    • Maintain or improve code coverage (target: β‰₯80%)
    • Pass all tests including race detector
    • Use gofmt and golint
  2. AI Usage Policy

    • ❌ Do NOT use AI for implementing package functionality or core logic
    • βœ… AI may assist with:
      • Writing and improving tests
      • Documentation and comments
      • Debugging and troubleshooting
    • All AI-assisted contributions must be reviewed and validated by humans
  3. Testing

    • Add tests for new features
    • Use Ginkgo v2 / Gomega for test framework
    • Ensure zero race conditions
    • Maintain coverage above 80%
  4. Documentation

    • Update GoDoc comments for public APIs
    • Add examples for new features
    • Update README.md if adding packages
    • Update TESTING.md if changing test structure
  5. Pull Request Process

    • Fork the repository
    • Create a feature branch
    • Write clear commit messages
    • Ensure all tests pass
    • Update documentation
    • Submit PR with description of changes

Future Enhancements

Potential improvements and new features for consideration:

Test Coverage Improvements

Priority Packages (current coverage <40%):

  1. archive (8.6% β†’ target 80%+)

    • Add tests for TAR/ZIP operations
    • Stream processing edge cases
    • Format detection scenarios
  2. aws (5.4% β†’ target 80%+)

    • S3 operations testing
    • IAM integration tests
    • MinIO compatibility tests
  3. artifact subpackages (6-23% β†’ target 80%+)

    • GitHub/GitLab/JFrog client tests
    • Authentication scenarios
    • Error handling coverage
  4. config/components (39-43% β†’ target 80%+)

    • Component configuration validation
    • Integration tests
    • Edge case handling
  5. database/kvdriver (38.4% β†’ target 80%+)

    • Key-value store operations
    • Transaction handling
    • Concurrent access tests
New Features

High Priority:

  • Distributed Tracing: OpenTelemetry integration for distributed systems
  • Service Mesh: Istio/Linkerd compatibility helpers
  • gRPC Support: gRPC server and client implementations
  • Event Streaming: Kafka, RabbitMQ integration packages
  • Circuit Breaker: Resilience patterns for failure handling

Medium Priority:

  • GraphQL: GraphQL server and client utilities
  • WebSocket: Enhanced WebSocket support
  • Rate Limiting: Advanced rate limiting algorithms (token bucket, sliding window)
  • Caching: Redis integration, distributed caching
  • Secrets Management: Vault, AWS Secrets Manager integration

Low Priority:

  • Machine Learning: Model serving utilities
  • Blockchain: Ethereum, Hyperledger integration
  • IoT: MQTT protocol support
  • Mobile: Mobile-specific optimizations
Performance Optimizations
  • Zero-Copy I/O: Extend zero-copy operations to more packages
  • SIMD: Leverage SIMD instructions for data processing
  • Memory Pooling: Reduce allocations in hot paths
  • Async I/O: io_uring support for Linux
  • Compilation: Pre-compiled binaries for common platforms
Documentation Enhancements
  • Interactive Examples: Runnable examples in documentation
  • Architecture Diagrams: Detailed architecture visualizations
  • Migration Guides: Upgrade guides between major versions
  • Best Practices: Extended best practices documentation
  • Video Tutorials: Video content for common use cases
Tooling Improvements
  • CLI Tool: golib command-line tool for scaffolding
  • Code Generator: Generate boilerplate for common patterns
  • Linter: Custom linter for golib best practices
  • Performance Profiler: Built-in profiling utilities
  • Dependency Analyzer: Analyze package dependencies
Community & Ecosystem
  • Plugin System: Extensible plugin architecture
  • Marketplace: Community-contributed packages
  • Templates: Project templates for common scenarios
  • Integration Tests: Comprehensive integration test suite
  • Benchmarking Suite: Cross-package performance benchmarks

Note: These enhancements are suggestions based on current gaps and industry trends. Actual implementation priorities depend on community feedback and real-world usage patterns.


Resources

Internal Documentation
Package Documentation

Individual package READMEs available in each subdirectory.

External References

AI Transparency

In compliance with EU AI Act Article 50.4: AI assistance was used for testing, documentation, and bug resolution under human supervision. All core functionality is human-designed and validated.


License

MIT License - See LICENSE file for details.

Copyright (c) 2019-2025 Nicolas JUHEL


Maintained by: Nicolas JUHEL
Repository: github.com/nabbar/golib
Version: See releases

Directories ΒΆ

Path Synopsis
Package archive provides unified archive handling for TAR and ZIP formats with automatic detection.
Package archive provides unified archive handling for TAR and ZIP formats with automatic detection.
archive/tar
Reader Component:
Reader Component:
archive/types
Package types defines common interfaces for archive reading and writing operations.
Package types defines common interfaces for archive reading and writing operations.
archive/zip
Package zip provides a simple interface for reading and writing ZIP archives.
Package zip provides a simple interface for reading and writing ZIP archives.
compress
Package compress provides unified compression and decompression utilities for multiple algorithms.
Package compress provides unified compression and decompression utilities for multiple algorithms.
helper
Package helper provides streaming compression and decompression helpers that wrap compression algorithms with unified io.ReadWriteCloser interfaces.
Package helper provides streaming compression and decompression helpers that wrap compression algorithms with unified io.ReadWriteCloser interfaces.
aws
Package cache provides a high-performance, thread-safe caching solution with automatic expiration management.
Package cache provides a high-performance, thread-safe caching solution with automatic expiration management.
item
Package item provides the internal cache item implementation for storing values with expiration.
Package item provides the internal cache item implementation for storing values with expiration.
Package certificates provides comprehensive TLS/SSL certificate management for secure communications.
Package certificates provides comprehensive TLS/SSL certificate management for secure communications.
auth
Package auth provides client authentication mode types and parsing for TLS connections.
Package auth provides client authentication mode types and parsing for TLS connections.
ca
Package ca provides Certificate Authority (CA) certificate management and parsing.
Package ca provides Certificate Authority (CA) certificate management and parsing.
certs
Package certs provides certificate pair (private key + certificate) management.
Package certs provides certificate pair (private key + certificate) management.
cipher
Package cipher provides TLS cipher suite selection and management.
Package cipher provides TLS cipher suite selection and management.
curves
Package curves provides elliptic curve configuration for TLS connections.
Package curves provides elliptic curve configuration for TLS connections.
tlsversion
Package tlsversion provides TLS version management and parsing.
Package tlsversion provides TLS version management and parsing.
Package cobra provides a comprehensive, production-ready wrapper around spf13/cobra for building professional CLI applications in Go.
Package cobra provides a comprehensive, production-ready wrapper around spf13/cobra for building professional CLI applications in Go.
const
Package _const provides constants used throughout the config package.
Package _const provides constants used throughout the config package.
Package console provides enhanced terminal I/O utilities for Go applications.
Package console provides enhanced terminal I/O utilities for Go applications.
gin
Package gin provides a wrapper around Gin context that integrates with Go's context.Context.
Package gin provides a wrapper around Gin context that integrates with Go's context.Context.
database
gorm
Package gorm provides a comprehensive wrapper around GORM ORM with connection management, monitoring, logging integration, and configuration validation.
Package gorm provides a comprehensive wrapper around GORM ORM with connection management, monitoring, logging integration, and configuration validation.
Package duration provides an extended duration type with days support and multiple encoding formats.
Package duration provides an extended duration type with days support and multiple encoding formats.
big
Package big provides duration handling for very large time intervals beyond time.Duration limits.
Package big provides duration handling for very large time intervals beyond time.Duration limits.
Package encoding provides a unified Coder interface for encoding and decoding operations.
Package encoding provides a unified Coder interface for encoding and decoding operations.
aes
Package aes provides AES-256-GCM authenticated encryption with streaming I/O support.
Package aes provides AES-256-GCM authenticated encryption with streaming I/O support.
hexa
Package hexa provides hexadecimal encoding and decoding with streaming I/O support.
Package hexa provides hexadecimal encoding and decoding with streaming I/O support.
mux
Package mux provides thread-safe multiplexing and demultiplexing for routing multiple logical channels over a single I/O stream.
Package mux provides thread-safe multiplexing and demultiplexing for routing multiple logical channels over a single I/O stream.
randRead
Package randRead provides a buffered io.ReadCloser for reading data from remote sources with automatic reconnection and error handling.
Package randRead provides a buffered io.ReadCloser for reading data from remote sources with automatic reconnection and error handling.
sha256
Package sha256 provides SHA-256 cryptographic hashing implementing the encoding.Coder interface.
Package sha256 provides SHA-256 cryptographic hashing implementing the encoding.Coder interface.
Package errors provides advanced error handling with error codes, stack tracing, and hierarchy management.
Package errors provides advanced error handling with error codes, stack tracing, and hierarchy management.
pool
Package pool provides a thread-safe error pool for collecting and managing multiple errors.
Package pool provides a thread-safe error pool for collecting and managing multiple errors.
file
bandwidth
Package bandwidth provides bandwidth throttling and rate limiting for file I/O operations.
Package bandwidth provides bandwidth throttling and rate limiting for file I/O operations.
perm
Package perm provides type-safe, portable file permission handling with support for multiple formats and serialization protocols.
Package perm provides type-safe, portable file permission handling with support for multiple formats and serialization protocols.
progress
Package progress provides file I/O operations with integrated real-time progress tracking and event callbacks.
Package progress provides file I/O operations with integrated real-time progress tracking and event callbacks.
Package ftpclient provides a thread-safe FTP client with automatic reconnection and connection pooling capabilities.
Package ftpclient provides a thread-safe FTP client with automatic reconnection and connection pooling capabilities.
Package httpcli provides advanced HTTP client management with DNS mapping capabilities.
Package httpcli provides advanced HTTP client management with DNS mapping capabilities.
dns-mapper
Package dns_mapper provides custom DNS hostname mapping and dialer functionality for HTTP clients.
Package dns_mapper provides custom DNS hostname mapping and dialer functionality for HTTP clients.
Package httpserver provides production-grade HTTP/HTTPS server management with comprehensive lifecycle control, configuration validation, TLS support, and integrated monitoring.
Package httpserver provides production-grade HTTP/HTTPS server management with comprehensive lifecycle control, configuration validation, TLS support, and integrated monitoring.
pool
Package pool provides unified management of multiple HTTP servers through a thread-safe pool abstraction.
Package pool provides unified management of multiple HTTP servers through a thread-safe pool abstraction.
types
Package types provides core type definitions and constants for HTTP server implementations.
Package types provides core type definitions and constants for HTTP server implementations.
Package ioutils provides a comprehensive suite of I/O utilities for Go applications, offering enhanced functionality for file operations, stream management, and data flow control.
Package ioutils provides a comprehensive suite of I/O utilities for Go applications, offering enhanced functionality for file operations, stream management, and data flow control.
aggregator
Package aggregator provides a thread-safe write aggregator that buffers and serializes concurrent write operations to a single writer function.
Package aggregator provides a thread-safe write aggregator that buffers and serializes concurrent write operations to a single writer function.
bufferReadCloser
Package bufferReadCloser provides lightweight wrappers around Go's standard buffered I/O types (bytes.Buffer, bufio.Reader, bufio.Writer, bufio.ReadWriter) that add io.Closer support with automatic resource cleanup and custom close callbacks.
Package bufferReadCloser provides lightweight wrappers around Go's standard buffered I/O types (bytes.Buffer, bufio.Reader, bufio.Writer, bufio.ReadWriter) that add io.Closer support with automatic resource cleanup and custom close callbacks.
delim
Package delim provides a buffered reader for reading delimiter-separated data streams.
Package delim provides a buffered reader for reading delimiter-separated data streams.
fileDescriptor
Package fileDescriptor provides cross-platform utilities for managing file descriptor limits in Go applications.
Package fileDescriptor provides cross-platform utilities for managing file descriptor limits in Go applications.
ioprogress
Package ioprogress provides thread-safe I/O progress tracking wrappers for monitoring read and write operations in real-time through customizable callbacks.
Package ioprogress provides thread-safe I/O progress tracking wrappers for monitoring read and write operations in real-time through customizable callbacks.
iowrapper
Package iowrapper provides a flexible I/O wrapper that enables customization and interception of read, write, seek, and close operations on any underlying I/O object without modifying its implementation.
Package iowrapper provides a flexible I/O wrapper that enables customization and interception of read, write, seek, and close operations on any underlying I/O object without modifying its implementation.
mapCloser
Package mapCloser provides a thread-safe, context-aware manager for multiple io.Closer instances.
Package mapCloser provides a thread-safe, context-aware manager for multiple io.Closer instances.
maxstdio
Package maxstdio provides Windows-specific functions for managing the maximum number of simultaneously open file handles (stdio streams) in a process through Windows CRT.
Package maxstdio provides Windows-specific functions for managing the maximum number of simultaneously open file handles (stdio streams) in a process through Windows CRT.
multi
Package multi provides a thread-safe, adaptive multi-writer that extends Go's standard io.MultiWriter with advanced features including adaptive sequential/parallel execution, latency monitoring, and comprehensive concurrency support.
Package multi provides a thread-safe, adaptive multi-writer that extends Go's standard io.MultiWriter with advanced features including adaptive sequential/parallel execution, latency monitoring, and comprehensive concurrency support.
nopwritecloser
Package nopwritecloser provides a wrapper that implements io.WriteCloser for an io.Writer by adding a no-op Close() method.
Package nopwritecloser provides a wrapper that implements io.WriteCloser for an io.Writer by adding a no-op Close() method.
Package logger provides a comprehensive, production-ready structured logging solution built on top of logrus with extensive customization options, multiple output destinations, and seamless integration with popular Go frameworks and libraries.
Package logger provides a comprehensive, production-ready structured logging solution built on top of logrus with extensive customization options, multiple output destinations, and seamless integration with popular Go frameworks and libraries.
config
Package config provides configuration structures and validation for the logger package.
Package config provides configuration structures and validation for the logger package.
entry
Package entry provides a flexible, chainable logger entry wrapper for structured logging with logrus.
Package entry provides a flexible, chainable logger entry wrapper for structured logging with logrus.
fields
Package fields provides a thread-safe, context-aware structured logging fields management system that seamlessly integrates with logrus and Go's standard context package.
Package fields provides a thread-safe, context-aware structured logging fields management system that seamlessly integrates with logrus and Go's standard context package.
gorm
Package gorm provides a thread-safe adapter that bridges golib's logging system with GORM v2's logger interface.
Package gorm provides a thread-safe adapter that bridges golib's logging system with GORM v2's logger interface.
hashicorp
Package hashicorp provides a thread-safe adapter that bridges golib's logging system with HashiCorp's hclog interface.
Package hashicorp provides a thread-safe adapter that bridges golib's logging system with HashiCorp's hclog interface.
hookfile
Package hookfile provides file-based logging hooks for logrus.
Package hookfile provides file-based logging hooks for logrus.
hookstderr
Package hookstderr provides a logrus hook for writing log entries to standard error (stderr) with configurable field filtering and formatting options.
Package hookstderr provides a logrus hook for writing log entries to standard error (stderr) with configurable field filtering and formatting options.
hookstdout
Package hookstdout provides a logrus hook for writing log entries to stdout with configurable field filtering, formatting options, and cross-platform color support.
Package hookstdout provides a logrus hook for writing log entries to stdout with configurable field filtering, formatting options, and cross-platform color support.
hooksyslog
Package hooksyslog provides a robust and flexible logrus hook for writing log entries to syslog endpoints.
Package hooksyslog provides a robust and flexible logrus hook for writing log entries to syslog endpoints.
hookwriter
Package hookwriter provides a logrus hook for writing log entries to custom io.Writer instances with configurable field filtering and formatting options.
Package hookwriter provides a logrus hook for writing log entries to custom io.Writer instances with configurable field filtering and formatting options.
level
Package level defines log severity levels with conversions and parsing capabilities.
Package level defines log severity levels with conversions and parsing capabilities.
types
Package types provides core types, interfaces, and constants for the logger subsystem.
Package types provides core types, interfaces, and constants for the logger subsystem.
mail
queuer
Package queuer provides a rate-limiting wrapper around SMTP clients.
Package queuer provides a rate-limiting wrapper around SMTP clients.
render
Package render provides email template rendering functionality using the Hermes library.
Package render provides email template rendering functionality using the Hermes library.
sender
Package sender provides a high-level API for composing and sending emails via SMTP.
Package sender provides a high-level API for composing and sending emails via SMTP.
smtp
Package smtp provides a high-level SMTP client implementation with support for TLS/STARTTLS connections, authentication, and health monitoring.
Package smtp provides a high-level SMTP client implementation with support for TLS/STARTTLS connections, authentication, and health monitoring.
smtp/config
Package config provides SMTP configuration parsing and validation.
Package config provides SMTP configuration parsing and validation.
smtp/tlsmode
Package tlsmode provides TLS connection mode types and utilities for SMTP connections.
Package tlsmode provides TLS connection mode types and utilities for SMTP connections.
Package monitor provides a robust health check monitoring system with automatic status transitions, configurable thresholds, and comprehensive metrics tracking.
Package monitor provides a robust health check monitoring system with automatic status transitions, configurable thresholds, and comprehensive metrics tracking.
info
Package info provides a thread-safe, caching implementation for monitor information.
Package info provides a thread-safe, caching implementation for monitor information.
pool
Package pool provides a thread-safe pool implementation for managing multiple health monitors.
Package pool provides a thread-safe pool implementation for managing multiple health monitors.
status
Package status provides a robust enumeration type for representing monitor health status.
Package status provides a robust enumeration type for representing monitor health status.
types
Package types provides core type definitions and interfaces for the monitor system.
Package types provides core type definitions and interfaces for the monitor system.
Package prometheus provides production-ready Prometheus metrics integration for Go applications with first-class support for the Gin web framework.
Package prometheus provides production-ready Prometheus metrics integration for Go applications with first-class support for the Gin web framework.
bloom
Package bloom provides a thread-safe Bloom filter implementation for Prometheus metrics.
Package bloom provides a thread-safe Bloom filter implementation for Prometheus metrics.
metrics
Package metrics provides a thread-safe wrapper around Prometheus metrics with full lifecycle management.
Package metrics provides a thread-safe wrapper around Prometheus metrics with full lifecycle management.
pool
Package pool provides a thread-safe registry for managing Prometheus metrics.
Package pool provides a thread-safe registry for managing Prometheus metrics.
types
Package types provides core type definitions for Prometheus metrics integration.
Package types provides core type definitions for Prometheus metrics integration.
webmetrics
Package webmetrics provides Prometheus metrics specifically designed for Gin web servers.
Package webmetrics provides Prometheus metrics specifically designed for Gin web servers.
Package retro provides retrocompatibility support for struct serialization across different versions.
Package retro provides retrocompatibility support for struct serialization across different versions.
Package router provides HTTP routing functionality built on top of the Gin web framework.
Package router provides HTTP routing functionality built on top of the Gin web framework.
auth
Package auth provides HTTP authorization middleware for Gin-based applications.
Package auth provides HTTP authorization middleware for Gin-based applications.
authheader
Package authheader provides HTTP authorization header constants and helper functions.
Package authheader provides HTTP authorization header constants and helper functions.
header
Package header provides HTTP header management for Gin-based applications.
Package header provides HTTP header management for Gin-based applications.
Package runner provides thread-safe lifecycle management for long-running services and periodic tasks.
Package runner provides thread-safe lifecycle management for long-running services and periodic tasks.
startStop
Package startStop provides a thread-safe runner for managing service lifecycle with start and stop operations.
Package startStop provides a thread-safe runner for managing service lifecycle with start and stop operations.
ticker
Package ticker provides a ticker-based runner implementation that executes a function at regular intervals.
Package ticker provides a ticker-based runner implementation that executes a function at regular intervals.
Package semaphore provides a high-level semaphore implementation with integrated progress bar support.
Package semaphore provides a high-level semaphore implementation with integrated progress bar support.
bar
Package bar provides a semaphore wrapper with integrated progress bar support.
Package bar provides a semaphore wrapper with integrated progress bar support.
nobar
Package bar provides a semaphore wrapper with integrated progress bar support.
Package bar provides a semaphore wrapper with integrated progress bar support.
sem
Package sem provides semaphore implementations for controlling concurrent goroutine execution.
Package sem provides semaphore implementations for controlling concurrent goroutine execution.
types
Package types defines the core interfaces for semaphore implementations with progress tracking.
Package types defines the core interfaces for semaphore implementations with progress tracking.
Package shell provides an interactive command-line shell interface with command registration, execution, and terminal interaction capabilities.
Package shell provides an interactive command-line shell interface with command registration, execution, and terminal interaction capabilities.
command
Package command provides a simple interface for creating and managing shell commands.
Package command provides a simple interface for creating and managing shell commands.
tty
Package tty provides terminal state management for saving and restoring terminal attributes.
Package tty provides terminal state management for saving and restoring terminal attributes.
Package size provides types and utilities for handling human-readable size representations.
Package size provides types and utilities for handling human-readable size representations.
Package socket provides a unified, production-ready framework for network socket communication across multiple protocols and platforms.
Package socket provides a unified, production-ready framework for network socket communication across multiple protocols and platforms.
client
Package client provides a unified, platform-aware factory for creating socket clients across different network protocols.
Package client provides a unified, platform-aware factory for creating socket clients across different network protocols.
client/tcp
Package tcp provides a robust, production-ready TCP client implementation with support for TLS, connection management, and comprehensive monitoring capabilities.
Package tcp provides a robust, production-ready TCP client implementation with support for TLS, connection management, and comprehensive monitoring capabilities.
client/udp
Package udp provides a UDP client implementation with callback mechanisms for datagram communication.
Package udp provides a UDP client implementation with callback mechanisms for datagram communication.
client/unix
Package unix provides a high-performance UNIX domain socket client implementation for local inter-process communication.
Package unix provides a high-performance UNIX domain socket client implementation for local inter-process communication.
client/unixgram
Package unixgram provides a Unix domain datagram socket client implementation.
Package unixgram provides a Unix domain datagram socket client implementation.
config
Package config provides configuration structures for creating socket clients and servers.
Package config provides configuration structures for creating socket clients and servers.
server
Package server provides a unified, platform-aware factory for creating socket servers across different network protocols.
Package server provides a unified, platform-aware factory for creating socket servers across different network protocols.
server/tcp
Package tcp provides a robust, production-ready TCP server implementation with support for TLS, connection management, and comprehensive monitoring capabilities.
Package tcp provides a robust, production-ready TCP server implementation with support for TLS, connection management, and comprehensive monitoring capabilities.
server/udp
Package udp provides a UDP server implementation with connectionless datagram support.
Package udp provides a UDP server implementation with connectionless datagram support.
server/unix
Package unix provides a robust, production-ready Unix domain socket server implementation for Go applications.
Package unix provides a robust, production-ready Unix domain socket server implementation for Go applications.
server/unixgram
Package unixgram provides a Unix domain datagram socket server implementation.
Package unixgram provides a Unix domain datagram socket server implementation.
Package static provides a secure, high-performance static file server for Gin framework with embedded filesystem support, comprehensive security features, and WAF/IDS/EDR integration.
Package static provides a secure, high-performance static file server for Gin framework with embedded filesystem support, comprehensive security features, and WAF/IDS/EDR integration.
Package status provides a comprehensive health check and status monitoring system for HTTP APIs.
Package status provides a comprehensive health check and status monitoring system for HTTP APIs.
control
Package control provides control modes for mandatory component validation.
Package control provides control modes for mandatory component validation.
listmandatory
Package listmandatory provides management of multiple mandatory component groups.
Package listmandatory provides management of multiple mandatory component groups.
mandatory
Package mandatory provides management of mandatory components with validation modes.
Package mandatory provides management of mandatory components with validation modes.
Package version provides version management and license handling for Go applications.
Package version provides version management and license handling for Go applications.
Package viper provides a wrapper around spf13/viper for configuration management with enhanced features including remote configuration support, custom decode hooks, and file watching capabilities.
Package viper provides a wrapper around spf13/viper for configuration management with enhanced features including remote configuration support, custom decode hooks, and file watching capabilities.

Jump to

Keyboard shortcuts

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