Skip to content

Commit

Permalink
MustGet print the error field name if no such field
Browse files Browse the repository at this point in the history
  • Loading branch information
sunfmin committed Sep 25, 2019
1 parent c120117 commit f129c4f
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion get.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ func MustGet(i interface{}, name string) (value interface{}) {
var err error
value, err = Get(i, name)
if err != nil {
panic(err)
panic(fmt.Sprintf("%s: %s of %+v", err, name, i))
}
return
}
Expand Down
2 changes: 1 addition & 1 deletion set.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ import (
"strings"
)

var NoSuchFieldError = errors.New("no such field.")
var NoSuchFieldError = errors.New("no such field")

// Set value of a struct by path using reflect.
func Set(i interface{}, name string, value interface{}) (err error) {
Expand Down

0 comments on commit f129c4f

Please sign in to comment.