summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEthan Koenig <ethantkoenig@gmail.com>2017-09-20 18:30:20 +0200
committerLauris BH <lauris@nix.lv>2017-09-20 18:30:20 +0200
commitf014e42a06b581c4d5cccf7b2138b0190ad9187e (patch)
tree079608072cd483bff53d51877bdcab90566e535f
parentRemove go version check for make fmt (#2558) (#2561) (diff)
downloadforgejo-f014e42a06b581c4d5cccf7b2138b0190ad9187e.tar.xz
forgejo-f014e42a06b581c4d5cccf7b2138b0190ad9187e.zip
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
-rw-r--r--integrations/mysql.ini2
-rw-r--r--integrations/pgsql.ini2
-rw-r--r--integrations/sqlite.ini5
-rw-r--r--models/gpg_key.go6
-rw-r--r--models/issue.go6
-rw-r--r--models/login_source.go5
-rw-r--r--models/migrations/v16.go6
-rw-r--r--models/migrations/v21.go5
-rw-r--r--models/org.go6
-rw-r--r--models/ssh_key.go6
-rw-r--r--modules/context/repo.go2
-rw-r--r--modules/lfs/content_store.go5
-rw-r--r--modules/log/file.go5
13 files changed, 12 insertions, 49 deletions
diff --git a/integrations/mysql.ini b/integrations/mysql.ini
index 2818e2bf36..82acc2443a 100644
--- a/integrations/mysql.ini
+++ b/integrations/mysql.ini
@@ -3,7 +3,7 @@ RUN_MODE = prod
[database]
DB_TYPE = mysql
-HOST = 127.0.0.1:3306
+HOST = mysql:3306
NAME = testgitea
USER = root
PASSWD =
diff --git a/integrations/pgsql.ini b/integrations/pgsql.ini
index 2deaa19638..fe979a6538 100644
--- a/integrations/pgsql.ini
+++ b/integrations/pgsql.ini
@@ -3,7 +3,7 @@ RUN_MODE = prod
[database]
DB_TYPE = postgres
-HOST = 127.0.0.1:5432
+HOST = pgsql:5432
NAME = testgitea
USER = postgres
PASSWD = postgres
diff --git a/integrations/sqlite.ini b/integrations/sqlite.ini
index c771507a76..799a44b472 100644
--- a/integrations/sqlite.ini
+++ b/integrations/sqlite.ini
@@ -3,11 +3,6 @@ RUN_MODE = prod
[database]
DB_TYPE = sqlite3
-HOST = 127.0.0.1:3306
-NAME = testgitea
-USER = gitea
-PASSWD =
-SSL_MODE = disable
PATH = :memory:
[repository]
diff --git a/models/gpg_key.go b/models/gpg_key.go
index 8d10511002..08573c1c7a 100644
--- a/models/gpg_key.go
+++ b/models/gpg_key.go
@@ -276,11 +276,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 2c385fd066..673d718ac5 100644
--- a/models/issue.go
+++ b/models/issue.go
@@ -572,11 +572,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 e4dc77714c..4778ccd656 100644
--- a/models/login_source.go
+++ b/models/login_source.go
@@ -509,10 +509,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 9cd4ef4da2..a2d0d9e040 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 e049727cbe..890f4de227 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 d43f15f9aa..63d9c0e465 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 649c50be6c..2d06c23f43 100644
--- a/models/ssh_key.go
+++ b/models/ssh_key.go
@@ -609,11 +609,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/context/repo.go b/modules/context/repo.go
index 72e922aaf0..ef70628bee 100644
--- a/modules/context/repo.go
+++ b/modules/context/repo.go
@@ -166,7 +166,7 @@ func RedirectToRepo(ctx *Context, redirectRepoID int64) {
func RepoIDAssignment() macaron.Handler {
return func(ctx *Context) {
var (
- err error
+ err error
)
repoID := ctx.ParamsInt64(":repoid")
diff --git a/modules/lfs/content_store.go b/modules/lfs/content_store.go
index 94bb10136f..3e1b2f345b 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 fe6c54ec38..18e82f7228 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) {