docs(config/etcd): fix the missing step of Load (#2450)

Co-authored-by: Guoqiang Ding <guoqiang10@staff.sina.com.cn>
pull/2412/head
Guoqiang Ding 2 years ago committed by GitHub
parent d82d607c21
commit e3feea6eeb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 10
      contrib/config/etcd/README.md

@ -30,12 +30,16 @@ if err != nil {
c := config.New(config.WithSource(source)) c := config.New(config.WithSource(source))
defer c.Close() defer c.Close()
// load sources before get
if err := c.Load(); err != nil {
log.Fatalln(err)
}
// acquire config value // acquire config value
foo, err := c.Value("/app-config").String() foo, err := c.Value("/app-config").String()
if err != nil { if err != nil {
log.Println(err) log.Fatalln(err)
} }
println(foo)
log.Println(foo)
``` ```

Loading…
Cancel
Save