diff options
author | CaiCandong <50507092+CaiCandong@users.noreply.github.com> | 2023-09-07 17:37:47 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-09-07 09:37:47 +0000 |
commit | a78c2eae243077c1fed5f7b056c64072d3c63ac8 (patch) | |
tree | 53b63a8dafde117e76f5fede968e384ae55779b1 /models/actions | |
parent | e97e883ad50774f249c8c694598c25a17227299b (diff) | |
download | gitea-a78c2eae243077c1fed5f7b056c64072d3c63ac8.tar.gz gitea-a78c2eae243077c1fed5f7b056c64072d3c63ac8.zip |
Replace `util.SliceXxx` with `slices.Xxx` (#26958)
Diffstat (limited to 'models/actions')
-rw-r--r-- | models/actions/run.go | 3 | ||||
-rw-r--r-- | models/actions/run_job.go | 5 |
2 files changed, 5 insertions, 3 deletions
diff --git a/models/actions/run.go b/models/actions/run.go index 18ed447e80..4853afc15b 100644 --- a/models/actions/run.go +++ b/models/actions/run.go @@ -6,6 +6,7 @@ package actions import ( "context" "fmt" + "slices" "strings" "time" @@ -350,7 +351,7 @@ func UpdateRun(ctx context.Context, run *ActionRun, cols ...string) error { // It's impossible that the run is not found, since Gitea never deletes runs. } - if run.Status != 0 || util.SliceContains(cols, "status") { + if run.Status != 0 || slices.Contains(cols, "status") { if run.RepoID == 0 { run, err = GetRunByID(ctx, run.ID) if err != nil { diff --git a/models/actions/run_job.go b/models/actions/run_job.go index 1da58bb659..4b8664077d 100644 --- a/models/actions/run_job.go +++ b/models/actions/run_job.go @@ -6,6 +6,7 @@ package actions import ( "context" "fmt" + "slices" "time" "code.gitea.io/gitea/models/db" @@ -107,11 +108,11 @@ func UpdateRunJob(ctx context.Context, job *ActionRunJob, cond builder.Cond, col return 0, err } - if affected == 0 || (!util.SliceContains(cols, "status") && job.Status == 0) { + if affected == 0 || (!slices.Contains(cols, "status") && job.Status == 0) { return affected, nil } - if affected != 0 && util.SliceContains(cols, "status") && job.Status.IsWaiting() { + if affected != 0 && slices.Contains(cols, "status") && job.Status.IsWaiting() { // if the status of job changes to waiting again, increase tasks version. if err := IncreaseTaskVersion(ctx, job.OwnerID, job.RepoID); err != nil { return 0, err |