Go Service Library
This open-source project provides a collection of high-quality Go (Golang) packages.
Each package adheres to common conventions and can be imported individually into any project.
These packages serve as a solid foundation for building fully-featured, production-ready web services.
You can generate a new web service by running make project CONFIG=project.cfg
. The project's name, description, and other settings can be customized in the configuration file specified by the CONFIG parameter.
The package documentation is available at: https://pkg.go.dev/github.com/Vonage/gosrvlib/
- category Library
- license MIT
- link https://github.com/Vonage/gosrvlib
gosrvlib offers a comprehensive collection of well-tested Go packages. Each package adheres to common conventions and coding standards, making them easy to integrate into your projects.
- awsopt – Utilities for configuring common AWS options with the aws-sdk-go-v2 library.
- awssecretcache – Client for retrieving and caching secrets from AWS Secrets Manager.
- bootstrap – Helpers for application bootstrap and initialization.
- config – Utilities for configuration loading and management.
- countrycode – Functions for country code lookup and validation.
- countryphone – Phone number parsing and country association.
- decint – Helpers for parsing and formatting decimal integers.
- devlake – Client for the DevLake Webhook API.
- dnscache – DNS resolution with caching support.
- encode – Utilities for data encoding and serialization.
- encrypt – Helpers for encryption and decryption.
- enumbitmap – Encode and decode slices of enumeration strings as integer bitmap values.
- enumcache – Caching for enumeration values with bitmap support.
- enumdb – Helpers for storing and retrieving enumeration sets in databases.
- errtrace – Error tracing and context propagation.
- filter – Generic rule-based filtering for struct slices.
- healthcheck – Health check endpoints and logic.
- httpclient – HTTP client with enhanced features.
- httpretrier – HTTP request retry logic.
- httpreverseproxy – HTTP reverse proxy implementation.
- httpserver – HTTP server setup and management.
- httputil – HTTP utility functions.
- jsendx – Helpers for JSend-compliant responses.
- ipify – IP address lookup using the ipify service.
- jirasrv – Client for Jira server APIs.
- jwt – JSON Web Token creation and validation.
- kafka – Kafka producer and consumer utilities.
- kafkacgo – Kafka integration using CGO bindings.
- logging – Structured logging utilities.
- maputil – Helpers for Go map manipulation.
- metrics – Metrics collection and reporting.
- prometheus – Prometheus metrics exporter.
- statsd – StatsD metrics exporter.
- mysqllock – Distributed locking using MySQL.
- numtrie – Trie data structure for numeric keys with partial matching.
- paging – Helpers for data pagination.
- passwordhash – Password hashing and verification.
- passwordpwned – Password breach checking via HaveIBeenPwned.
- periodic – Periodic task scheduling.
- phonekeypad – Phone keypad mapping utilities.
- profiling – Application profiling tools.
- randkey – Helpers for random key generation.
- random – Utilities for random data generation.
- redact – Data redaction helpers.
- redis – Redis client and utilities.
- retrier – Retry logic for operations.
- s3 – Helpers for AWS S3 integration.
- sfcache – Simple, in-memory, thread-safe, fixed-size, single-flight cache for expensive lookups.
- slack – Client for sending messages via the Slack API Webhook.
- sleuth – Client for the Sleuth.io API.
- sliceutil – Utilities for slice manipulation.
- sqlconn – Helpers for SQL database connections.
- sqltransaction – SQL transaction management.
- sqlutil – SQL utility functions.
- sqlxtransaction – Helpers for SQLX transactions.
- sqs – Utilities for AWS SQS (Simple Queue Service) integration.
- stringkey – Create unique hash keys from multiple strings.
- stringmetric – String similarity and distance metrics.
- testutil – Utilities for testing.
- threadsafe – Thread-safe data structures.
- timeutil – Time and date utilities.
- traceid – Trace ID generation and management.
- typeutil – Type conversion and utility functions.
- uidc – Unique identifier generation.
- validator – Data validation utilities.
- valkey – Wrapper client for interacting with valkey.io, an open-source in-memory data store.
To get started quickly with this project, follow these steps:
- Ensure you have the latest versions of Go and Python 3 installed (Python is required for additional tests).
- Clone the repository:
git clone https://github.com/Vonage/gosrvlib.git
- Navigate to the project directory:
cd gosrvlib
- Install dependencies and run all tests:
make x
You are now ready to start developing with gosrvlib!
This project includes a Makefile that simplifies testing and building on Linux-compatible systems. All artifacts and reports generated by the Makefile are stored in the target folder.
Alternatively, you can build the project inside a Docker container using:
make dbuild
This command uses the environment defined in resources/docker/Dockerfile.dev
.
To view all available Makefile options, run:
make help
Before committing your code, ensure it is properly formatted and passes all tests by running:
make x
Alternatively, you can build and test the project inside a Docker container with:
make dbuild
Refer to the examples/service
directory for a sample web service built using this library.
To create a new project based on the example and the settings defined in project.cfg
, run:
make project CONFIG=project.cfg