1
1
mirror of https://github.com/go-gitea/gitea synced 2025-12-07 13:28:25 +00:00

chore: golang lint

This commit is contained in:
Jason Song
2022-11-26 20:14:03 +08:00
parent 3b119f3d78
commit 0bd9553219
11 changed files with 93 additions and 107 deletions

View File

@@ -6,7 +6,6 @@ package bots
import (
"context"
"encoding/json"
"fmt"
"time"
@@ -14,6 +13,7 @@ import (
repo_model "code.gitea.io/gitea/models/repo"
user_model "code.gitea.io/gitea/models/user"
"code.gitea.io/gitea/models/webhook"
"code.gitea.io/gitea/modules/json"
api "code.gitea.io/gitea/modules/structs"
"code.gitea.io/gitea/modules/timeutil"

View File

@@ -52,10 +52,7 @@ func (jobs RunJobList) LoadRuns(ctx context.Context, withRepo bool) error {
}
func (jobs RunJobList) LoadAttributes(ctx context.Context, withRepo bool) error {
if err := jobs.LoadRuns(ctx, withRepo); err != nil {
return err
}
return nil
return jobs.LoadRuns(ctx, withRepo)
}
type FindRunJobOptions struct {

View File

@@ -317,7 +317,8 @@ func CreateTaskForRunner(ctx context.Context, runner *Runner) (*Task, bool, erro
// TODO: a more efficient way to filter labels
var job *RunJob
labels := append(runner.AgentLabels, runner.CustomLabels...)
labels := runner.AgentLabels
labels = append(labels, runner.CustomLabels...)
log.Trace("runner labels: %v", labels)
for _, v := range jobs {
if isSubset(labels, v.RunsOn) {

View File

@@ -50,10 +50,7 @@ func (tasks TaskList) LoadJobs(ctx context.Context) error {
}
func (tasks TaskList) LoadAttributes(ctx context.Context) error {
if err := tasks.LoadJobs(ctx); err != nil {
return err
}
return nil
return tasks.LoadJobs(ctx)
}
type FindTaskOptions struct {