Skip to content

Commit f014e42

Browse files
ethantkoeniglafriks
authored andcommitted
Backport: Fix lint, fmt and integration testing errors (#2553)
* Fix lint errors * Fix fmt errors (#2544) * Hotfix for integration testing (#2473) * Hotfix for integration testing
1 parent d14a724 commit f014e42

File tree

13 files changed

+12
-49
lines changed

13 files changed

+12
-49
lines changed

integrations/mysql.ini

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ RUN_MODE = prod
33

44
[database]
55
DB_TYPE = mysql
6-
HOST = 127.0.0.1:3306
6+
HOST = mysql:3306
77
NAME = testgitea
88
USER = root
99
PASSWD =

integrations/pgsql.ini

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ RUN_MODE = prod
33

44
[database]
55
DB_TYPE = postgres
6-
HOST = 127.0.0.1:5432
6+
HOST = pgsql:5432
77
NAME = testgitea
88
USER = postgres
99
PASSWD = postgres

integrations/sqlite.ini

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,6 @@ RUN_MODE = prod
33

44
[database]
55
DB_TYPE = sqlite3
6-
HOST = 127.0.0.1:3306
7-
NAME = testgitea
8-
USER = gitea
9-
PASSWD =
10-
SSL_MODE = disable
116
PATH = :memory:
127

138
[repository]

models/gpg_key.go

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -276,11 +276,7 @@ func DeleteGPGKey(doer *User, id int64) (err error) {
276276
return err
277277
}
278278

279-
if err = sess.Commit(); err != nil {
280-
return err
281-
}
282-
283-
return nil
279+
return sess.Commit()
284280
}
285281

286282
// CommitVerification represents a commit validation of signature

models/issue.go

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -572,11 +572,7 @@ func (issue *Issue) ReadBy(userID int64) error {
572572
return err
573573
}
574574

575-
if err := setNotificationStatusReadIfUnread(x, userID, issue.ID); err != nil {
576-
return err
577-
}
578-
579-
return nil
575+
return setNotificationStatusReadIfUnread(x, userID, issue.ID)
580576
}
581577

582578
func updateIssueCols(e Engine, issue *Issue, cols ...string) error {

models/login_source.go

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -509,10 +509,7 @@ func SMTPAuth(a smtp.Auth, cfg *SMTPConfig) error {
509509
}
510510

511511
if ok, _ := c.Extension("AUTH"); ok {
512-
if err = c.Auth(a); err != nil {
513-
return err
514-
}
515-
return nil
512+
return c.Auth(a)
516513
}
517514
return ErrUnsupportedLoginType
518515
}

models/migrations/v16.go

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -119,9 +119,5 @@ func addUnitsToTables(x *xorm.Engine) error {
119119
}
120120
}
121121

122-
if err := sess.Commit(); err != nil {
123-
return err
124-
}
125-
126-
return nil
122+
return sess.Commit()
127123
}

models/migrations/v21.go

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,5 @@ func useNewPublickeyFormat(x *xorm.Engine) error {
5151
}
5252

5353
f.Close()
54-
if err = os.Rename(tmpPath, fpath); err != nil {
55-
return err
56-
}
57-
return nil
54+
return os.Rename(tmpPath, fpath)
5855
}

models/org.go

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -235,11 +235,7 @@ func DeleteOrganization(org *User) (err error) {
235235
}
236236
}
237237

238-
if err = sess.Commit(); err != nil {
239-
return err
240-
}
241-
242-
return nil
238+
return sess.Commit()
243239
}
244240

245241
func deleteOrg(e *xorm.Session, u *User) error {

models/ssh_key.go

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -609,11 +609,7 @@ func RewriteAllPublicKeys() error {
609609
defer f.Close()
610610
}
611611

612-
if err = os.Rename(tmpPath, fPath); err != nil {
613-
return err
614-
}
615-
616-
return nil
612+
return os.Rename(tmpPath, fPath)
617613
}
618614

619615
// ________ .__ ____ __.

modules/context/repo.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,7 @@ func RedirectToRepo(ctx *Context, redirectRepoID int64) {
166166
func RepoIDAssignment() macaron.Handler {
167167
return func(ctx *Context) {
168168
var (
169-
err error
169+
err error
170170
)
171171

172172
repoID := ctx.ParamsInt64(":repoid")

modules/lfs/content_store.go

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -70,10 +70,7 @@ func (s *ContentStore) Put(meta *models.LFSMetaObject, r io.Reader) error {
7070
return errHashMismatch
7171
}
7272

73-
if err := os.Rename(tmpPath, path); err != nil {
74-
return err
75-
}
76-
return nil
73+
return os.Rename(tmpPath, path)
7774
}
7875

7976
// Exists returns true if the object exists in the content store.

modules/log/file.go

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -110,10 +110,7 @@ func (w *FileLogWriter) StartLogger() error {
110110
return err
111111
}
112112
w.mw.SetFd(fd)
113-
if err = w.initFd(); err != nil {
114-
return err
115-
}
116-
return nil
113+
return w.initFd()
117114
}
118115

119116
func (w *FileLogWriter) docheck(size int) {

0 commit comments

Comments
 (0)