Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: err != nil check, just return error instead #5093

Merged
merged 4 commits into from
Oct 18, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 4 additions & 15 deletions cmd/admin.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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 {
Expand Down Expand Up @@ -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)
}
5 changes: 1 addition & 4 deletions models/migrations/v68.go
Original file line number Diff line number Diff line change
Expand Up @@ -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()
}