Cache auth.Client in OnInit (eliminates per-probe app.Auth call in HealthCheck). Replace all fmt.Errorf with xerrors structured errors (ErrInvalidInput / ErrInternal). Bump health/launcher/logz to v1.0.1, add xerrors v1.0.1, Go directive to 1.26. API committed as stable.
1.6 KiB
1.6 KiB
v1.0.0
code.nochebuena.dev/go/firebase
Overview
firebase manages the lifecycle of a firebase.google.com/go/v4 App: validates
configuration at init time, initialises the SDK App, exposes the native *firebase.App
to consumers, and performs health checks by probing the Firebase Auth service.
v1.0.0 caches the auth.Client inside the component (eliminating per-probe allocation),
adopts xerrors for all structured error returns, bumps all micro-lib dependencies to v1,
and commits the API as stable.
What Changed Since v0.9.0
Auth client cached in OnInit
OnInit now calls app.Auth(context.Background()) once and stores the result on the
component. HealthCheck uses the cached client directly — no per-probe app.Auth(ctx)
call.
Structured errors via xerrors
All fmt.Errorf calls replaced with xerrors:
| Situation | Code |
|---|---|
ProjectID empty |
ErrInvalidInput |
fb.NewApp fails |
ErrInternal (wraps SDK error) |
app.Auth fails |
ErrInternal (wraps SDK error) |
HealthCheck before OnInit |
ErrInternal |
Dependency updates
health,launcher,logzbumped fromv0.9.xtov1.0.1xerrors v1.0.1added as direct dependency- Go directive bumped from
1.25to1.26
Full API (stable)
Config—ProjectID string(FIREBASE_PROJECT_ID, required)Provider—App() *fb.AppComponent— embedslauncher.Component+health.Checkable+ProviderNew(logger, cfg) Component
Installation
go get code.nochebuena.dev/go/firebase@v1.0.0
Changelog
See CHANGELOG.md.