From 20b2595082492089de93551eb4008a69f1e9a216 Mon Sep 17 00:00:00 2001 From: Rene Nochebuena Guerrero Date: Fri, 7 Aug 2026 22:14:06 -0600 Subject: [PATCH] docs(cache-valkey): 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. (component.go doc comment corrected too.) 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 | 9 +++++---- component.go | 7 ++++--- doc.go | 5 +++-- 3 files changed, 12 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index 02ab2d6..6e127c0 100644 --- a/README.md +++ b/README.md @@ -17,8 +17,9 @@ import cachevalkey "code.nochebuena.dev/einherjar/cache-valkey" vk := cachevalkey.New(logger, cachevalkey.Config{ Addrs: []string{"localhost:6379"}, }) -launcher.Register(vk) // OnInit → OnStart → OnStop -health.Register(vk) // PING-based health check, LevelDegraded +lc.Append(vk) // OnInit → OnStart → OnStop +// vk is observability.Checkable (PING-based, LevelDegraded): +srv.Get("/health", health.NewHandler(logger, vk).ServeHTTP) ``` ## Connecting to other modules @@ -30,8 +31,8 @@ them directly to the consuming modules: ```go // --- 1. Create the component (lifecycle + health + Provider) --- vk := cachevalkey.New(logger, cfg) -launcher.Register(vk) -health.Register(vk) +lc.Append(vk) +srv.Get("/health", health.NewHandler(logger, vk).ServeHTTP) // --- 2. Create adapters (one per consumer interface) --- // Each adapter wraps vk (a Provider) and satisfies one interface in another module. diff --git a/component.go b/component.go index 8dffeb6..933bf76 100644 --- a/component.go +++ b/component.go @@ -7,10 +7,11 @@ import ( // Component is the full cache-valkey capability: lifecycle management, health checks, // and all Provider operations. -// Register with launcher and health before starting the application: +// Append it to a launcher, and wire a health endpoint (it satisfies +// observability.Checkable): // -// launcher.Register(vk) -// health.Register(vk) +// lc.Append(vk) +// srv.Get("/health", health.NewHandler(logger, vk).ServeHTTP) type Component interface { lifecycle.Component observability.Checkable diff --git a/doc.go b/doc.go index de63ac9..a9557ab 100644 --- a/doc.go +++ b/doc.go @@ -4,8 +4,9 @@ // # Quick start // // vk := cachevalkey.New(logger, cfg) -// launcher.Register(vk) // lifecycle: OnInit → OnStart → OnStop -// health.Register(vk) // health: PING-based, LevelDegraded +// lc.Append(vk) // lifecycle: OnInit → OnStart → OnStop +// // vk satisfies observability.Checkable (PING-based, LevelDegraded) — wire a health endpoint: +// srv.Get("/health", health.NewHandler(logger, vk).ServeHTTP) // // # Adapters // -- 2.39.5