Skip to content

Vonage/gosrvlib

gosrvlib

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/

Go Reference
check Coverage Status Coverage Lines of Code
Go Report Card Quality Gate Status Reliability Rating Maintainability Rating Security Rating
Bugs Vulnerabilities Technical Debt Code Smells


TOC


Packages

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.
    • tsmap – Thread-safe map implementation.
    • tsslice – Thread-safe slice implementation.
  • 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.

Developers' Quick Start

To get started quickly with this project, follow these steps:

  1. Ensure you have the latest versions of Go and Python 3 installed (Python is required for additional tests).
  2. Clone the repository:
    git clone https://github.com/Vonage/gosrvlib.git
  3. Navigate to the project directory:
    cd gosrvlib
  4. 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

Running all tests

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

Web-service project example

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

About

Go library to provide base service components

Resources

License

Code of conduct

Contributing

Security policy

Stars

Watchers

Forks

Packages

No packages published

Contributors 13

Languages