From ff1f372ed6d3a0426865bcea4b03e87858159570 Mon Sep 17 00:00:00 2001 From: straydragon Date: Thu, 15 Aug 2024 17:34:52 +0800 Subject: [PATCH] doc: fix example code typo --- docs/docs/getting-started.md | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/docs/docs/getting-started.md b/docs/docs/getting-started.md index 51fb0ec..076ae51 100644 --- a/docs/docs/getting-started.md +++ b/docs/docs/getting-started.md @@ -81,11 +81,11 @@ func (c *Car) Start() { ```go func main() { // create DI container and inject package services - injector := do.New() + i := do.New() - do.Provide(injector, NewCar) - do.Provide(injector, NewEngine) - do.ProvideValue(&Config{ + do.Provide(i, NewCar) + do.Provide(i, NewEngine) + do.ProvideValue(i, &Config{ Port: 4242, }) @@ -95,7 +95,7 @@ func main() { log.Fatal(err.Error()) } - car.Start() // that's all folk 🤗 + car.Start() // that's all folk 🤗 // handle ctrl-c and shutdown services i.ShutdownOnSignals(syscall.SIGTERM, os.Interrupt) @@ -112,12 +112,12 @@ var Package = do.Package( do.Lazy(NewEngine), do.Eager(&Config{ Port: 4242, - }) + }), ) func main() { // create DI container and inject package services - injector := do.New(Package) + i := do.New(Package) // invoking car will instantiate Car services and its Engine dependency car, err := do.Invoke[*Car](i)