golib

package module
v0.22.10 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 28, 2026 License: MIT Imports: 0 Imported by: 0

README

Go lib

Shared Go library for the A-Novel backend services — the glue they'd otherwise copy between repos.

X (formerly Twitter) Follow Discord


GitHub go.mod Go version GitHub repo file or directory count GitHub code size in bytes

GitHub Actions Workflow Status Go Report Card

What this is

Not a framework, and small on purpose: if a well-maintained library already covers it, it doesn't live here. A sub-package that grows a broad API of its own graduates to its own repo, as jwt did.

Full reference: godoc on pkg.go.dev.

Installation

go get github.com/a-novel-kit/golib

Sub-packages

Each sub-package is a directory-scoped, independently importable helper — focused, dependency-light, and shared across services. One that grows a broad API of its own graduates to its own repo (see What this is).

Path What it's for
config Loads environment variables into typed config structs and fails fast at startup when one is missing or malformed, so a service never boots half-configured.
otel Wires OpenTelemetry tracing and logging under a shared app identity and reports each operation's outcome on its span. Exporters ship for local development and Google Cloud.
httpf Holds the REST boundary logic a handler leans on — mapping domain error sentinels to HTTP status codes and writing JSON — so every service answers errors the same way.
grpcf The gRPC equivalent of httpf: it shapes per-call context, supplies client and server credentials (local or GCP), and bundles a health/echo service for tests.
logging Defines the interfaces the platform logs through, so a service can swap its log backend without touching call sites. Presets cover local and Google Cloud, for both HTTP and gRPC.
postgres Carries the database handle on the request context and scopes work into transactions, and ships a migration runner plus harnesses that give each test an isolated database.
smtp Sends transactional mail behind one Sender interface, with a real SMTP sender for production and a debug sender for local runs and tests.

Contributing

Setup and day-to-day commands are in the developer onboarding guide; golib-specific notes are in CONTRIBUTING.md.

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis
smtptest
Package smtptest provides an in-memory implementation of smtp.Sender for use in unit and integration tests.
Package smtptest provides an in-memory implementation of smtp.Sender for use in unit and integration tests.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL