Skip to content

hibare/GoCommon

Repository files navigation

GoCommon Logo

Go Report Card GitHub issues GitHub pull requests GitHub GitHub release (latest by date)

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.


Table of Contents


Overview

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.


Installation

go get github.com/hibare/GoCommon/v2

Makefile Commands

This 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 test

Usage

Import 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.


Package Documentation

Each package has its own detailed documentation:


Contributing

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.

License

This project is licensed under the MIT License.

About

Go common packages

Resources

Stars

Watchers

Forks

Contributors