Skip to content

Commit

Permalink
docs: Fix example code in Readme to match generated image (#22)
Browse files Browse the repository at this point in the history
  • Loading branch information
thessem authored Aug 25, 2024
1 parent 44b8f84 commit 06d0bbd
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,12 +62,12 @@ type UserAddress struct {
func (u *User) MarshalLogObject(e zapcore.ObjectEncoder) error {
e.AddString("name", u.Name)
e.AddInt("age", u.Age)
e.OpenNamespace("address")
e.AddString("street", u.Address.Street)
e.AddString("city", u.Address.City)
if u.Friend != nil {
_ = e.AddObject("friend", u.Friend)
}
e.OpenNamespace("address")
e.AddString("street", u.Address.Street)
e.AddString("city", u.Address.City)
return nil
}

Expand Down
6 changes: 3 additions & 3 deletions internal/readme/readme.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -62,12 +62,12 @@ type UserAddress struct {
func (u *User) MarshalLogObject(e zapcore.ObjectEncoder) error {
e.AddString("name", u.Name)
e.AddInt("age", u.Age)
e.OpenNamespace("address")
e.AddString("street", u.Address.Street)
e.AddString("city", u.Address.City)
if u.Friend != nil {
_ = e.AddObject("friend", u.Friend)
}
e.OpenNamespace("address")
e.AddString("street", u.Address.Street)
e.AddString("city", u.Address.City)
return nil
}

Expand Down

0 comments on commit 06d0bbd

Please sign in to comment.