From 12d3ec061c14be85ef65da8735a7394670cae015 Mon Sep 17 00:00:00 2001 From: JamesSlocumIH <132921739+JamesSlocumIH@users.noreply.github.com> Date: Thu, 27 Jun 2024 11:21:03 -0500 Subject: [PATCH] Update modules.md I don't think the example follows good coding conventions. If `Config` is supposed to be a parameter object, it should be named `Params` since the constructor is called `New(...)` and needs defined `fx.In` within. If it is not meant to be an parameter object, I think passing `Params` into the constructor without defining that in the example is confusing. --- docs/modules.md | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/docs/modules.md b/docs/modules.md index 41f28e045..599f7087b 100644 --- a/docs/modules.md +++ b/docs/modules.md @@ -133,7 +133,9 @@ var Module = fx.Module("server", ), ) -type Config struct { +type Params struct { + fx.In + Addr string `yaml:"addr"` } @@ -142,7 +144,7 @@ func New(p Params) (Result, error) { In this example, we don't export `parseConfig`, because it's a trivial `yaml.Decode` that we don't need to expose, -but we still export `Config` so users can decode it themselves. +but we still export `Params` so users can decode it themselves. **Rationale**: It should be possible to use your Fx module without using Fx itself.