A modern, modular Go library providing reusable utilities and abstractions for cloud, configuration, concurrency, file operations, HTTP, logging, validation, and more. Designed for extensibility, testability, and ease of use in real-world Go projects.
GoCommon is a collection of well-tested, production-ready Go packages for common application needs:
- Cloud: AWS S3 utilities
- Configuration: YAML config loading, OS-aware paths
- Concurrency: Parallel task execution
- Database: Abstractions for PostgreSQL and SQLite
- Environment: Type-safe env var access
- Errors: Standardized error types
- File: Archiving, hashing, downloading, and more
- HTTP: Middleware, handlers, and client utilities
- Logging: Structured logging with multiple modes
- Maps/Slices/Structs: Generic helpers for data manipulation
- Validation: Struct validation with custom error messages
- Versioning: GitHub release checks
Each package is documented and designed for easy integration and testing.
go get github.com/hibare/GoCommon/v2This project provides a Makefile to simplify common development tasks. Use these commands to lint, test, and manage dependencies:
| Command | Description |
|---|---|
make help |
Display all available make targets |
make clean |
Cleanup and tidy Go modules |
make init |
Initialize project (lint & pre-commit setup) |
make install-golangci-lint |
Install golangci-lint if not present |
make install-pre-commit |
Install pre-commit git hooks |
make test |
Run tests |
Example:
make testImport only the packages you need. Example:
import (
"github.com/hibare/GoCommon/v2/pkg/logger"
"github.com/hibare/GoCommon/v2/pkg/env"
)
logger.InitDefaultLogger()
port := env.MustInt("PORT", 8080)See the Package Documentation for detailed usage and examples for each module.
Each package has its own detailed documentation:
- AWS
- Concurrency
- Config
- Constants
- Context
- Crypto
- Datetime
- DB
- Env
- Errors
- File
- HTTP
- Less
- Logger
- Maps
- Net
- Notifiers
- Slice
- Structs
- Testhelper
- Utils
- Validator
Contributions are welcome! Please open issues or pull requests for bug fixes, new features, or documentation improvements.
- Follow Go best practices and style guidelines.
- Add or update tests for your changes.
- Document new features in the relevant package doc.
This project is licensed under the MIT License.
