diff options
author | Bo-Yi Wu <appleboy.tw@gmail.com> | 2018-10-18 12:51:07 +0800 |
---|---|---|
committer | techknowlogick <hello@techknowlogick.com> | 2018-10-18 00:51:07 -0400 |
commit | 1e3441323899170e8aad9ed7c735cefc79cfeb11 (patch) | |
tree | 95de6f1ac96a72b3c4e79e3de86de1997e44952a | |
parent | e4b8103ac7110726bebbe7194ad794d649249fc5 (diff) | |
download | gitea-1e3441323899170e8aad9ed7c735cefc79cfeb11.tar.gz gitea-1e3441323899170e8aad9ed7c735cefc79cfeb11.zip |
refactor: err != nil check, just return error instead (#5093)
-rw-r--r-- | cmd/admin.go | 19 | ||||
-rw-r--r-- | models/migrations/v68.go | 5 |
2 files changed, 5 insertions, 19 deletions
diff --git a/cmd/admin.go b/cmd/admin.go index 047f3befcc..893b6f5be9 100644 --- a/cmd/admin.go +++ b/cmd/admin.go @@ -412,16 +412,12 @@ func runAddOauth(c *cli.Context) error { return err } - if err := models.CreateLoginSource(&models.LoginSource{ + return models.CreateLoginSource(&models.LoginSource{ Type: models.LoginOAuth2, Name: c.String("name"), IsActived: true, Cfg: parseOAuth2Config(c), - }); err != nil { - return err - } - - return nil + }) } func runUpdateOauth(c *cli.Context) error { @@ -492,11 +488,7 @@ func runUpdateOauth(c *cli.Context) error { oAuth2Config.CustomURLMapping = customURLMapping source.Cfg = oAuth2Config - if err := models.UpdateSource(source); err != nil { - return err - } - - return nil + return models.UpdateSource(source) } func runListAuth(c *cli.Context) error { @@ -543,8 +535,5 @@ func runDeleteAuth(c *cli.Context) error { return err } - if err = models.DeleteSource(source); err != nil { - return err - } - return nil + return models.DeleteSource(source) } diff --git a/models/migrations/v68.go b/models/migrations/v68.go index e27b896c82..68c8d237fd 100644 --- a/models/migrations/v68.go +++ b/models/migrations/v68.go @@ -205,9 +205,6 @@ func reformatAndRemoveIncorrectTopics(x *xorm.Engine) (err error) { return err } } - if err := sess.Commit(); err != nil { - return err - } - return nil + return sess.Commit() } |