summaryrefslogtreecommitdiffstats
path: root/model/oauth.go
diff options
context:
space:
mode:
authorChris <ccbrown112@gmail.com>2018-01-30 17:23:00 -0600
committerCorey Hulen <corey@hulen.com>2018-01-30 15:23:00 -0800
commit0c8968fb8df4ce302c928118cd81e75f5bef2861 (patch)
treeb17a2ae5afc98f7ce3daaea10a165d9d647c47c5 /model/oauth.go
parentac2e42a480c5bba2e5128017218b0fa1bed8e836 (diff)
downloadchat-0c8968fb8df4ce302c928118cd81e75f5bef2861.tar.gz
chat-0c8968fb8df4ce302c928118cd81e75f5bef2861.tar.bz2
chat-0c8968fb8df4ce302c928118cd81e75f5bef2861.zip
unnamed return (#8170)
Diffstat (limited to 'model/oauth.go')
-rw-r--r--model/oauth.go53
1 files changed, 13 insertions, 40 deletions
diff --git a/model/oauth.go b/model/oauth.go
index 3139aefed..70e8a3f26 100644
--- a/model/oauth.go
+++ b/model/oauth.go
@@ -110,12 +110,8 @@ func (a *OAuthApp) PreUpdate() {
// ToJson convert a User to a json string
func (a *OAuthApp) ToJson() string {
- b, err := json.Marshal(a)
- if err != nil {
- return ""
- } else {
- return string(b)
- }
+ b, _ := json.Marshal(a)
+ return string(b)
}
// Generate a valid strong etag so the browser can cache the results
@@ -140,52 +136,29 @@ func (a *OAuthApp) IsValidRedirectURL(url string) bool {
// OAuthAppFromJson will decode the input and return a User
func OAuthAppFromJson(data io.Reader) *OAuthApp {
- decoder := json.NewDecoder(data)
- var app OAuthApp
- err := decoder.Decode(&app)
- if err == nil {
- return &app
- } else {
- return nil
- }
+ var app *OAuthApp
+ json.NewDecoder(data).Decode(&app)
+ return app
}
func OAuthAppMapToJson(a map[string]*OAuthApp) string {
- b, err := json.Marshal(a)
- if err != nil {
- return ""
- } else {
- return string(b)
- }
+ b, _ := json.Marshal(a)
+ return string(b)
}
func OAuthAppMapFromJson(data io.Reader) map[string]*OAuthApp {
- decoder := json.NewDecoder(data)
var apps map[string]*OAuthApp
- err := decoder.Decode(&apps)
- if err == nil {
- return apps
- } else {
- return nil
- }
+ json.NewDecoder(data).Decode(&apps)
+ return apps
}
func OAuthAppListToJson(l []*OAuthApp) string {
- b, err := json.Marshal(l)
- if err != nil {
- return ""
- } else {
- return string(b)
- }
+ b, _ := json.Marshal(l)
+ return string(b)
}
func OAuthAppListFromJson(data io.Reader) []*OAuthApp {
- decoder := json.NewDecoder(data)
var o []*OAuthApp
- err := decoder.Decode(&o)
- if err == nil {
- return o
- } else {
- return nil
- }
+ json.NewDecoder(data).Decode(&o)
+ return o
}