aboutsummaryrefslogtreecommitdiffstats
path: root/models/task.go
diff options
context:
space:
mode:
authorBo-Yi Wu <appleboy.tw@gmail.com>2021-03-15 02:52:12 +0800
committerGitHub <noreply@github.com>2021-03-14 19:52:12 +0100
commit167b0f46ef946fad3ca13976c3b87598f505e2ea (patch)
tree8b6a4a47a2a0149899b3eb49b296677c2dba4d36 /models/task.go
parent164e35ead3c1b9b82d4a23644f6fe96652a747eb (diff)
downloadgitea-167b0f46ef946fad3ca13976c3b87598f505e2ea.tar.gz
gitea-167b0f46ef946fad3ca13976c3b87598f505e2ea.zip
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.
Diffstat (limited to 'models/task.go')
-rw-r--r--models/task.go8
1 files changed, 4 insertions, 4 deletions
diff --git a/models/task.go b/models/task.go
index 35b77a878f..8d4bfbf076 100644
--- a/models/task.go
+++ b/models/task.go
@@ -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
}