Browse Source

Fix lint errors (#2547)

Ethan Koenig 2 years ago
parent
commit
4cb9394a97

+ 1 - 5
models/gpg_key.go

@@ -282,11 +282,7 @@ func DeleteGPGKey(doer *User, id int64) (err error) {
282 282
 		return err
283 283
 	}
284 284
 
285
-	if err = sess.Commit(); err != nil {
286
-		return err
287
-	}
288
-
289
-	return nil
285
+	return sess.Commit()
290 286
 }
291 287
 
292 288
 // CommitVerification represents a commit validation of signature

+ 1 - 5
models/issue.go

@@ -571,11 +571,7 @@ func (issue *Issue) ReadBy(userID int64) error {
571 571
 		return err
572 572
 	}
573 573
 
574
-	if err := setNotificationStatusReadIfUnread(x, userID, issue.ID); err != nil {
575
-		return err
576
-	}
577
-
578
-	return nil
574
+	return setNotificationStatusReadIfUnread(x, userID, issue.ID)
579 575
 }
580 576
 
581 577
 func updateIssueCols(e Engine, issue *Issue, cols ...string) error {

+ 1 - 4
models/login_source.go

@@ -498,10 +498,7 @@ func SMTPAuth(a smtp.Auth, cfg *SMTPConfig) error {
498 498
 	}
499 499
 
500 500
 	if ok, _ := c.Extension("AUTH"); ok {
501
-		if err = c.Auth(a); err != nil {
502
-			return err
503
-		}
504
-		return nil
501
+		return c.Auth(a)
505 502
 	}
506 503
 	return ErrUnsupportedLoginType
507 504
 }

+ 1 - 5
models/migrations/v16.go

@@ -119,9 +119,5 @@ func addUnitsToTables(x *xorm.Engine) error {
119 119
 		}
120 120
 	}
121 121
 
122
-	if err := sess.Commit(); err != nil {
123
-		return err
124
-	}
125
-
126
-	return nil
122
+	return sess.Commit()
127 123
 }

+ 1 - 4
models/migrations/v21.go

@@ -51,8 +51,5 @@ func useNewPublickeyFormat(x *xorm.Engine) error {
51 51
 	}
52 52
 
53 53
 	f.Close()
54
-	if err = os.Rename(tmpPath, fpath); err != nil {
55
-		return err
56
-	}
57
-	return nil
54
+	return os.Rename(tmpPath, fpath)
58 55
 }

+ 1 - 5
models/org.go

@@ -235,11 +235,7 @@ func DeleteOrganization(org *User) (err error) {
235 235
 		}
236 236
 	}
237 237
 
238
-	if err = sess.Commit(); err != nil {
239
-		return err
240
-	}
241
-
242
-	return nil
238
+	return sess.Commit()
243 239
 }
244 240
 
245 241
 func deleteOrg(e *xorm.Session, u *User) error {

+ 1 - 5
models/ssh_key.go

@@ -599,11 +599,7 @@ func RewriteAllPublicKeys() error {
599 599
 		defer f.Close()
600 600
 	}
601 601
 
602
-	if err = os.Rename(tmpPath, fPath); err != nil {
603
-		return err
604
-	}
605
-
606
-	return nil
602
+	return os.Rename(tmpPath, fPath)
607 603
 }
608 604
 
609 605
 // ________                .__                 ____  __.

+ 1 - 4
modules/lfs/content_store.go

@@ -70,10 +70,7 @@ func (s *ContentStore) Put(meta *models.LFSMetaObject, r io.Reader) error {
70 70
 		return errHashMismatch
71 71
 	}
72 72
 
73
-	if err := os.Rename(tmpPath, path); err != nil {
74
-		return err
75
-	}
76
-	return nil
73
+	return os.Rename(tmpPath, path)
77 74
 }
78 75
 
79 76
 // Exists returns true if the object exists in the content store.

+ 1 - 4
modules/log/file.go

@@ -110,10 +110,7 @@ func (w *FileLogWriter) StartLogger() error {
110 110
 		return err
111 111
 	}
112 112
 	w.mw.SetFd(fd)
113
-	if err = w.initFd(); err != nil {
114
-		return err
115
-	}
116
-	return nil
113
+	return w.initFd()
117 114
 }
118 115
 
119 116
 func (w *FileLogWriter) docheck(size int) {