Skip to content

Repository files navigation

eureka

Common, non-domain-specific primitives shared across PlexiOSS's Go services (Popplio and friends). Nothing in here should know about bots, servers, staff permissions, or anything else specific to Omniplex — that's what keeps it safe to reuse. If a piece of code needs a change that only makes sense for one consumer's business logic, it belongs in that consumer, not here.

Packages

Package What it's for
uapi Unified API handling — routing, auth, timeouts, and caching, built in. The backbone of Popplio's public route layer.
doclib Documentation types shared by uapi routes for generating API docs.
dovewing Custom Discord user fetching and caching.
zapchi A modified chi request logger with zap support.
crypto Common cryptography primitives (random string generation, etc).
pem RSA keypair generation, PEM-encoded.
proxy A Discord-aware HTTP proxy.
ratelimit Rate limiting for HTTP handlers.
hotcache A generic cache interface (HotCache[T]), with a Redis-backed implementation provided — bring your own if Redis doesn't fit.
genconfig Generates config file scaffolding/docs from a Go config struct.
snippets Small reusable helpers (zap setup, etc.) that don't warrant their own package.
jsonimpl Marshal/unmarshal that transparently uses sonic on amd64/linux and falls back to encoding/json everywhere else.
dbutil GetCols(s any) []string — derives a SQL column list from a struct's db tags, so a query and the struct it scans into can't silently drift apart.
taggedunion Encodes/decodes Go structs as serde's default externally-tagged enum representation ({"Variant": {...}} / "UnitVariant") — for services that need to speak a wire format encoding/json has no native equivalent for.
typedresp A small typed HTTP response builder (JSON/text/no-content/stream) for services that dispatch to a handler and write its result afterward, rather than writing to http.ResponseWriter inline.

dbutil, taggedunion, and typedresp were extracted out of Popplio's arcadia package — that code had nothing Arcadia-specific about it, it was just infrastructure that happened to be written there first. If you're touching Popplio and reach for something that feels like "generic plumbing, not business logic," check here before reinventing it — there's now precedent for pulling exactly that kind of code out.

Using eureka in a consumer (e.g. Popplio)

Popplio depends on a tagged version from go.mod:

github.com/infinitybotlist/eureka v1.10.0

Bumping to a newer eureka release is the usual Go module dance:

go get github.com/infinitybotlist/eureka@v1.11.0   # or @latest for the newest tag
go mod tidy

Developing against unreleased eureka changes

If you're changing something in eureka and want to test it in Popplio (or another consumer) before publishing a new version, point go.mod at your local checkout instead of a real version:

go mod edit -replace github.com/infinitybotlist/eureka=../eureka
go build ./...   # now compiles against your local eureka working copy

Never commit that replace line — it hardcodes a filesystem path that only exists on your machine, and it'll break the build for everyone else the moment they pull it. Drop it before committing:

go mod edit -dropreplace github.com/infinitybotlist/eureka
go mod tidy

Publishing a new eureka version

Once a change here is ready for consumers to actually pick up:

  1. Commit and push it to this repo's main branch.
  2. Tag the commit with the next semver version (git tag v1.11.0 && git push origin v1.11.0) — eureka has no other release process, the git tag is the release.
  3. In each consumer (Popplio, etc.), run go get github.com/infinitybotlist/eureka@v1.11.0 and commit the resulting go.mod/go.sum diff.

Bump the minor version for additive, backward-compatible changes (new packages, new functions) and the major version for anything that breaks an existing consumer's build. There's no changelog convention here yet — the commit history and git tags are the record.

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Used by

Contributors

Languages