2 Commits
Author SHA1 Message Date
Rene Nochebuena ce72260b0b docs(smtp): fix wiring doc examples; align to v1.1.1 2026-08-07 23:32:57 -06:00
Rene Nochebuena af6f5ab9e6 docs(smtp): fix fictional launcher.Register/health.Register in doc examples (#2)
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.

Reviewed-on: #2
Co-authored-by: Rene Nochebuena Guerrero <rene@nochebuena.dev>
Co-committed-by: Rene Nochebuena Guerrero <rene@nochebuena.dev>
2026-08-07 22:19:52 -06:00
4 changed files with 16 additions and 11 deletions
+4 -3
View File
@@ -1,6 +1,6 @@
# einherjar/smtp # einherjar/smtp
[![version](https://img.shields.io/badge/version-v1.1.0-5C4EE5?style=flat-square)](https://code.nochebuena.dev/einherjar/smtp) [![version](https://img.shields.io/badge/version-v1.1.1-5C4EE5?style=flat-square)](https://code.nochebuena.dev/einherjar/smtp)
[![license](https://img.shields.io/badge/license-AGPL--3.0-22863A?style=flat-square)](LICENSE) [![license](https://img.shields.io/badge/license-AGPL--3.0-22863A?style=flat-square)](LICENSE)
[![go](https://img.shields.io/badge/Go-1.26+-00ADD8?style=flat-square&logo=go&logoColor=white)](https://go.dev) [![go](https://img.shields.io/badge/Go-1.26+-00ADD8?style=flat-square&logo=go&logoColor=white)](https://go.dev)
[![health](https://img.shields.io/badge/health-degraded-E36209?style=flat-square)]() [![health](https://img.shields.io/badge/health-degraded-E36209?style=flat-square)]()
@@ -19,8 +19,9 @@
import "code.nochebuena.dev/einherjar/smtp" import "code.nochebuena.dev/einherjar/smtp"
mailer := smtp.New(logger, smtp.DefaultConfig()) mailer := smtp.New(logger, smtp.DefaultConfig())
launcher.Append(mailer) // OnInit verifies credentials; OnStop is a no-op lc.Append(mailer) // OnInit verifies credentials; OnStop is a no-op
health.Register(mailer) // dial check; LevelDegraded // 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. 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.
+6 -2
View File
@@ -12,8 +12,12 @@
// # Lifecycle Registration // # Lifecycle Registration
// //
// client := smtp.New(logger, cfg) // client := smtp.New(logger, cfg)
// launcher.Register(client) // lc.Append(client) // lifecycle: OnInit → OnStop
// health.Register(client) //
// client satisfies [observability.Checkable], so it can back a health endpoint via
// web/health.NewHandler:
//
// srv.Get("/health", health.NewHandler(logger, client).ServeHTTP)
// //
// # Sending // # Sending
// //
+2 -2
View File
@@ -3,6 +3,6 @@ module code.nochebuena.dev/einherjar/smtp
go 1.26 go 1.26
require ( require (
code.nochebuena.dev/einherjar/contracts v1.1.0 code.nochebuena.dev/einherjar/contracts v1.1.1
code.nochebuena.dev/einherjar/core v1.1.0 code.nochebuena.dev/einherjar/core v1.1.1
) )
+4 -4
View File
@@ -1,4 +1,4 @@
code.nochebuena.dev/einherjar/contracts v1.1.0 h1:GsGr6reyrd9qCc7D8CqbT1LWPTeeK9lT4r4EdsNA5Ro= code.nochebuena.dev/einherjar/contracts v1.1.1 h1:MRQUR8Q1D4wIOUIz11vpAdsapWqFTMwr0/VRvWbGO3s=
code.nochebuena.dev/einherjar/contracts v1.1.0/go.mod h1:ccltUtrFb5+MEJdkx2VVEUL+xC5pupVlVVsMM8AlCWI= code.nochebuena.dev/einherjar/contracts v1.1.1/go.mod h1:ccltUtrFb5+MEJdkx2VVEUL+xC5pupVlVVsMM8AlCWI=
code.nochebuena.dev/einherjar/core v1.1.0 h1:zxj9bFPthEEFRnvWV/vgNZqWa2y/kAo3p5pODWablyk= code.nochebuena.dev/einherjar/core v1.1.1 h1:W6V/Peh1ffWjqZnBuBQLn4UGM+bgvWt9MQuktTEfDFw=
code.nochebuena.dev/einherjar/core v1.1.0/go.mod h1:Ot2JbjsnZ33Ed5C9Ev1kSn2PW+F4dLz/LRwIUh+fYt0= code.nochebuena.dev/einherjar/core v1.1.1/go.mod h1:ninuZlnO178zC4rOdt5vjGojnlOpygP8cDorrecAeTY=