From b7da0e37edcefe4c144817ac7737e39b6113d4dc Mon Sep 17 00:00:00 2001 From: Rene Nochebuena Guerrero Date: Fri, 7 Aug 2026 22:14:01 -0600 Subject: [PATCH] docs(smtp): fix fictional launcher.Register/health.Register in doc examples The package-doc examples showed a fictional launcher.Register / health.Register API (and launcher.Append as a package func). Corrected to the real wiring: lc.Append + web/health.NewHandler(...).ServeHTTP. Documentation-only. No code, API, or dependency changes; version stays v1.1.0 (the v1.1.0 tag is moved to include this fix). Verified by compiling the corrected pattern against the real API. --- README.md | 5 +++-- doc.go | 8 ++++++-- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 8ca8e57..48d6461 100644 --- a/README.md +++ b/README.md @@ -19,8 +19,9 @@ import "code.nochebuena.dev/einherjar/smtp" mailer := smtp.New(logger, smtp.DefaultConfig()) -launcher.Append(mailer) // OnInit verifies credentials; OnStop is a no-op -health.Register(mailer) // dial check; LevelDegraded +lc.Append(mailer) // OnInit verifies credentials; OnStop is a no-op +// mailer is observability.Checkable (dial check, LevelDegraded): +srv.Get("/health", health.NewHandler(logger, mailer).ServeHTTP) ``` When `cfg.Host` is empty, `New` returns a no-op that logs every `Send` call at debug level and always returns nil. No code changes are needed between environments. diff --git a/doc.go b/doc.go index f1c67c7..6e2c3de 100644 --- a/doc.go +++ b/doc.go @@ -12,8 +12,12 @@ // # Lifecycle Registration // // client := smtp.New(logger, cfg) -// launcher.Register(client) -// health.Register(client) +// lc.Append(client) // lifecycle: OnInit → OnStop +// +// client satisfies [observability.Checkable], so it can back a health endpoint via +// web/health.NewHandler: +// +// srv.Get("/health", health.NewHandler(logger, client).ServeHTTP) // // # Sending //