From 4cb9394a978af75794d43accc231b6649f2884bc Mon Sep 17 00:00:00 2001 From: Ethan Koenig Date: Tue, 19 Sep 2017 01:08:30 -0700 Subject: [PATCH] Fix lint errors (#2547) --- models/gpg_key.go | 6 +----- models/issue.go | 6 +----- models/login_source.go | 5 +---- models/migrations/v16.go | 6 +----- models/migrations/v21.go | 5 +---- models/org.go | 6 +----- models/ssh_key.go | 6 +----- modules/lfs/content_store.go | 5 +---- modules/log/file.go | 5 +---- 9 files changed, 9 insertions(+), 41 deletions(-) diff --git a/models/gpg_key.go b/models/gpg_key.go index 70dd4fbda..85a44338e 100644 --- a/models/gpg_key.go +++ b/models/gpg_key.go @@ -282,11 +282,7 @@ func DeleteGPGKey(doer *User, id int64) (err error) { return err } - if err = sess.Commit(); err != nil { - return err - } - - return nil + return sess.Commit() } // CommitVerification represents a commit validation of signature diff --git a/models/issue.go b/models/issue.go index a8149b123..7884507a2 100644 --- a/models/issue.go +++ b/models/issue.go @@ -571,11 +571,7 @@ func (issue *Issue) ReadBy(userID int64) error { return err } - if err := setNotificationStatusReadIfUnread(x, userID, issue.ID); err != nil { - return err - } - - return nil + return setNotificationStatusReadIfUnread(x, userID, issue.ID) } func updateIssueCols(e Engine, issue *Issue, cols ...string) error { diff --git a/models/login_source.go b/models/login_source.go index 186a5e051..c43afd58b 100644 --- a/models/login_source.go +++ b/models/login_source.go @@ -498,10 +498,7 @@ func SMTPAuth(a smtp.Auth, cfg *SMTPConfig) error { } if ok, _ := c.Extension("AUTH"); ok { - if err = c.Auth(a); err != nil { - return err - } - return nil + return c.Auth(a) } return ErrUnsupportedLoginType } diff --git a/models/migrations/v16.go b/models/migrations/v16.go index ef342a5f8..8ce37ea7d 100644 --- a/models/migrations/v16.go +++ b/models/migrations/v16.go @@ -119,9 +119,5 @@ func addUnitsToTables(x *xorm.Engine) error { } } - if err := sess.Commit(); err != nil { - return err - } - - return nil + return sess.Commit() } diff --git a/models/migrations/v21.go b/models/migrations/v21.go index e049727cb..890f4de22 100644 --- a/models/migrations/v21.go +++ b/models/migrations/v21.go @@ -51,8 +51,5 @@ func useNewPublickeyFormat(x *xorm.Engine) error { } f.Close() - if err = os.Rename(tmpPath, fpath); err != nil { - return err - } - return nil + return os.Rename(tmpPath, fpath) } diff --git a/models/org.go b/models/org.go index 31febe254..eaf7ba602 100644 --- a/models/org.go +++ b/models/org.go @@ -235,11 +235,7 @@ func DeleteOrganization(org *User) (err error) { } } - if err = sess.Commit(); err != nil { - return err - } - - return nil + return sess.Commit() } func deleteOrg(e *xorm.Session, u *User) error { diff --git a/models/ssh_key.go b/models/ssh_key.go index 873eab3bf..539c60e69 100644 --- a/models/ssh_key.go +++ b/models/ssh_key.go @@ -599,11 +599,7 @@ func RewriteAllPublicKeys() error { defer f.Close() } - if err = os.Rename(tmpPath, fPath); err != nil { - return err - } - - return nil + return os.Rename(tmpPath, fPath) } // ________ .__ ____ __. diff --git a/modules/lfs/content_store.go b/modules/lfs/content_store.go index 94bb10136..3e1b2f345 100644 --- a/modules/lfs/content_store.go +++ b/modules/lfs/content_store.go @@ -70,10 +70,7 @@ func (s *ContentStore) Put(meta *models.LFSMetaObject, r io.Reader) error { return errHashMismatch } - if err := os.Rename(tmpPath, path); err != nil { - return err - } - return nil + return os.Rename(tmpPath, path) } // Exists returns true if the object exists in the content store. diff --git a/modules/log/file.go b/modules/log/file.go index fe6c54ec3..18e82f722 100644 --- a/modules/log/file.go +++ b/modules/log/file.go @@ -110,10 +110,7 @@ func (w *FileLogWriter) StartLogger() error { return err } w.mw.SetFd(fd) - if err = w.initFd(); err != nil { - return err - } - return nil + return w.initFd() } func (w *FileLogWriter) docheck(size int) {