golib

package module
v0.22.2 Latest Latest
Warning

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

Go to latest
Published: May 22, 2026 License: MIT Imports: 0 Imported by: 0

README

Go lib

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


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

What this is

golib collects the small amount of cross-cutting glue that the a-novel backend services would otherwise copy from one repo to the next — env-variable parsing, OpenTelemetry plumbing, Postgres + bun helpers, REST and gRPC boundary utilities, shared logging interfaces, and an SMTP sender. It is not a framework and is explicitly kept as small as possible: anything that a well-maintained library already covers belongs in that library, not here. When a sub-package outgrows the "boilerplate" bar and earns a broader public API, it graduates into its own repo (the jwt package is the precedent).

Sub-packages

Path What it covers
config LoadEnv[T] + a set of strconv-shaped parsers for environment variables; Must / MustUnmarshal panic-on-error helpers for one-shot startup wiring.
otel Tracer / Logger accessors keyed on a shared AppName, the ReportError / ReportSuccess span helpers, and a Config interface implemented by otel/presets/*.
httpf HandleError(errMap) for mapping sentinels onto HTTP status codes (and reporting them on the request span); SendJSON for the success path.
grpcf BaseContext*Interceptor for per-call context shaping, a CredentialsProvider interface with local / GCP implementations, and a built-in echo + health-check demo service.
logging The shared Log / HTTPConfig / RPCConfig interfaces; concrete implementations live in logging/presets/* (local and GCP variants for both HTTP and gRPC).
postgres bun.IDB-on-context plumbing (NewContext, GetContext, RunInTx), the migrations runner, the PassthroughTx test wrapper, and RunTransactionalTest / -Isolated.
smtp Sender interface with ProdSender (real SMTP) and DebugSender (writes to an io.Writer); the in-memory test helper now lives in smtp/smtptest.

The full API reference is on pkg.go.dev — godoc is the canonical documentation; this README only points at it.

Contributing

See the org-wide guide at a-novel-kit/.github. The bar for additions to golib is deliberately high — convenience wrappers around well-maintained dependencies, and one-off helpers that only one service needs, do not belong here.

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