diff options
author | George Goldberg <george@gberg.me> | 2018-02-06 17:25:53 +0000 |
---|---|---|
committer | George Goldberg <george@gberg.me> | 2018-02-06 17:25:53 +0000 |
commit | 7941c30117efe1b957ac0458c2f0479e3824196d (patch) | |
tree | df791632a9dc790a6f73dec53aae3ba919ebda63 /model/user_search.go | |
parent | e1cd64613591cf5a990442a69ebf188258bd0cb5 (diff) | |
parent | 034dbc07e3068c482e654b6a1a8fcbe4b01c44f3 (diff) | |
download | chat-7941c30117efe1b957ac0458c2f0479e3824196d.tar.gz chat-7941c30117efe1b957ac0458c2f0479e3824196d.tar.bz2 chat-7941c30117efe1b957ac0458c2f0479e3824196d.zip |
Merge branch 'master' into advanced-permissions-phase-1
Diffstat (limited to 'model/user_search.go')
-rw-r--r-- | model/user_search.go | 19 |
1 files changed, 5 insertions, 14 deletions
diff --git a/model/user_search.go b/model/user_search.go index 6213b16e4..94596bdcd 100644 --- a/model/user_search.go +++ b/model/user_search.go @@ -20,22 +20,13 @@ type UserSearch struct { // ToJson convert a User to a json string func (u *UserSearch) ToJson() string { - b, err := json.Marshal(u) - if err != nil { - return "" - } else { - return string(b) - } + b, _ := json.Marshal(u) + return string(b) } // UserSearchFromJson will decode the input and return a User func UserSearchFromJson(data io.Reader) *UserSearch { - decoder := json.NewDecoder(data) - var us UserSearch - err := decoder.Decode(&us) - if err == nil { - return &us - } else { - return nil - } + var us *UserSearch + json.NewDecoder(data).Decode(&us) + return us } |