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

Backport: Fix lint, fmt and integration testing errors #2553

Merged
merged 3 commits into from
Sep 20, 2017
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
2 changes: 1 addition & 1 deletion integrations/mysql.ini
Original file line number Diff line number Diff line change
Expand Up @@ -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 =
Expand Down
2 changes: 1 addition & 1 deletion integrations/pgsql.ini
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
5 changes: 0 additions & 5 deletions integrations/sqlite.ini
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down
6 changes: 1 addition & 5 deletions models/gpg_key.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 1 addition & 5 deletions models/issue.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
5 changes: 1 addition & 4 deletions models/login_source.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down
6 changes: 1 addition & 5 deletions models/migrations/v16.go
Original file line number Diff line number Diff line change
Expand Up @@ -119,9 +119,5 @@ func addUnitsToTables(x *xorm.Engine) error {
}
}

if err := sess.Commit(); err != nil {
return err
}

return nil
return sess.Commit()
}
5 changes: 1 addition & 4 deletions models/migrations/v21.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
6 changes: 1 addition & 5 deletions models/org.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
6 changes: 1 addition & 5 deletions models/ssh_key.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}

// ________ .__ ____ __.
Expand Down
2 changes: 1 addition & 1 deletion modules/context/repo.go
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down
5 changes: 1 addition & 4 deletions modules/lfs/content_store.go
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
5 changes: 1 addition & 4 deletions modules/log/file.go
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down