From e3feea6eebfbadd871924fc83f9753f505d3ad81 Mon Sep 17 00:00:00 2001 From: Guoqiang Ding Date: Tue, 18 Oct 2022 20:05:37 +0800 Subject: [PATCH] docs(config/etcd): fix the missing step of Load (#2450) Co-authored-by: Guoqiang Ding --- contrib/config/etcd/README.md | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/contrib/config/etcd/README.md b/contrib/config/etcd/README.md index d76687458..d69edd82b 100644 --- a/contrib/config/etcd/README.md +++ b/contrib/config/etcd/README.md @@ -30,12 +30,16 @@ if err != nil { c := config.New(config.WithSource(source)) defer c.Close() +// load sources before get +if err := c.Load(); err != nil { + log.Fatalln(err) +} + // acquire config value foo, err := c.Value("/app-config").String() if err != nil { - log.Println(err) + log.Fatalln(err) } -println(foo) +log.Println(foo) ``` -