https://github.com/sapcc/go-bits
Tiny Go libraries that I keep copying between projects
https://github.com/sapcc/go-bits
Last synced: 2 months ago
JSON representation
Tiny Go libraries that I keep copying between projects
- Host: GitHub
- URL: https://github.com/sapcc/go-bits
- Owner: sapcc
- License: apache-2.0
- Created: 2018-07-09T12:57:54.000Z (almost 7 years ago)
- Default Branch: master
- Last Pushed: 2025-04-17T14:20:14.000Z (3 months ago)
- Last Synced: 2025-04-18T04:58:54.397Z (3 months ago)
- Language: Go
- Size: 884 KB
- Stars: 12
- Watchers: 53
- Forks: 4
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
- License: LICENSE
- Audit: audittools/auditor.go
- Codeowners: .github/CODEOWNERS
Awesome Lists containing this project
README
# go-bits
[](https://godoc.org/github.com/sapcc/go-bits)
Some tiny pieces of Go code, extracted from their original applications for
reusability. Feel free to add to this.## Packages
* [assert](./assert) contains various assertions for unit tests.
* [audittools](./audittools) contains a microframework for establishing a connection to a RabbitMQ server (with sane defaults) and publishing messages to it.
* [easypg](./easypg) is a database library for applications that use PostgreSQL. It integrates [golang-migrate/migrate](https://github.com/golang-migrate/migrate) for data definition and imports the libpq-based SQL driver.
* [errext](./errext) contains convenience functions for handling and propagating errors.
* [gophercloudext](./gophercloudext) contains convenience functions for use with [Gophercloud](https://github.com/gophercloud/gophercloud). It is specifically intended as a lightweight replacement for `gophercloud/utils` with fewer dependencies.
* [gopherpolicy](./gopherpolicy) integrates [Gophercloud](https://github.com/gophercloud/gophercloud) with [goslo.policy](https://github.com/databus23/goslo.policy), for OpenStack services that need to validate client tokens and check permissions.
* [httpapi](./httpapi) contains opinionated base machinery for assembling and exposing an API consisting of HTTP endpoints.
* [httpext](./httpext) adds some convenience functions to [net/http](https://golang.org/pkg/net/http).
* [httptest](./httptest) builds on [net/http/httptest](https://golang.org/pkg/net/http/httptest) to make process-local HTTP requests inside tests as smooth as possible.
* [jobloop](./jobloop) contains the Job trait, which abstracts over reusable implementations of worker loops.
* [liquidapi](./liquidapi) contains a server runtime and various other utilities for microservices implementing the [LIQUID API](https://pkg.go.dev/github.com/sapcc/go-api-declarations/liquid).
* [logg](./logg) adds some convenience functions to [log](https://golang.org/pkg/log/).
* [mock](./mock) contains basic mocks and test doubles.
* [must](./must) contains convenience functions for quickly exiting on fatal errors without the need for excessive `if err != nil`.
* [osext](./osext) contains extensions to the standard library package "os", mostly relating to parsing of environment variables.
* [pluggable](./pluggable) is a tiny plugin factory library, for constructing different objects implementing a common interface based on a configurable type selector.
* [promquery](./promquery) provides a simplified interface for executing Prometheus queries.
* [regexpext](./regexpext) contains convenience functions for marshalling regexes to and from string values in YAML and JSON documents.
* [respondwith](./respondwith) contains some helper functions for generating responses in HTTP handlers.
* [secrets](./secrets) provides convenience functions for working with auth credentials.
* [sqlext](./sqlext) contains helper functions for SQL queries that are not specific to PostgreSQL.
* [vault](./vault) contains helper functions to work with HashiCorp Vault.## Tools
The `tools` subdirectory contains small Go programs.
* [release-info](./tools/release-info) extracts release info for a specific version from a
changelog file that uses the [Keep a changelog](https://keepachangelog.com) format.