chore(models): rewrite code format. (#14754)

* chore: rewrite format.

* chore: update format

Signed-off-by: Bo-Yi Wu <appleboy.tw@gmail.com>

* chore: update format

Signed-off-by: Bo-Yi Wu <appleboy.tw@gmail.com>

* chore: Adjacent parameters with the same type should be grouped together

* chore: update format.
This commit is contained in:
Bo-Yi Wu 2021-03-15 02:52:12 +08:00 committed by GitHub
parent 164e35ead3
commit 167b0f46ef
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
103 changed files with 474 additions and 460 deletions

View file

@ -135,7 +135,7 @@ func (err ErrTaskDoesNotExist) Error() string {
// GetMigratingTask returns the migrating task by repo's id
func GetMigratingTask(repoID int64) (*Task, error) {
var task = Task{
task := Task{
RepoID: repoID,
Type: structs.TaskTypeMigrateRepo,
}
@ -150,7 +150,7 @@ func GetMigratingTask(repoID int64) (*Task, error) {
// GetMigratingTaskByID returns the migrating task by repo's id
func GetMigratingTaskByID(id, doerID int64) (*Task, *migration.MigrateOptions, error) {
var task = Task{
task := Task{
ID: id,
DoerID: doerID,
Type: structs.TaskTypeMigrateRepo,
@ -177,7 +177,7 @@ type FindTaskOptions struct {
// ToConds generates conditions for database operation.
func (opts FindTaskOptions) ToConds() builder.Cond {
var cond = builder.NewCond()
cond := builder.NewCond()
if opts.Status >= 0 {
cond = cond.And(builder.Eq{"status": opts.Status})
}
@ -186,7 +186,7 @@ func (opts FindTaskOptions) ToConds() builder.Cond {
// FindTasks find all tasks
func FindTasks(opts FindTaskOptions) ([]*Task, error) {
var tasks = make([]*Task, 0, 10)
tasks := make([]*Task, 0, 10)
err := x.Where(opts.ToConds()).Find(&tasks)
return tasks, err
}