chore: update deps, adapt lint, use json v2 (#1185)

- Raised go to 1.27
- Adopted json v2
- Sync lint config from gitea
- Fixed all issues

Co-authored-by: silverwind <me@silverwind.io>
Reviewed-on: https://gitea.com/gitea/runner/pulls/1185
Reviewed-by: bircni <bircni@icloud.com>
Co-authored-by: Renovate Bot <renovate-bot@gitea.com>
This commit is contained in:
Renovate Bot
2026-08-24 19:53:17 +00:00
committed by bircni
parent 7b4356c746
commit e30c2fed62
47 changed files with 319 additions and 288 deletions
+8 -6
View File
@@ -54,15 +54,16 @@ func runDaemon(ctx context.Context, daemArgs *daemonArgs, configFile *string) fu
// processes with the same identity are indistinguishable to Gitea and
// end up cancelling each other's jobs.
releaseLock, err := lock.TryLock(cfg.Runner.File)
if errors.Is(err, lock.ErrLocked) {
switch {
case errors.Is(err, lock.ErrLocked):
log.Errorf("another gitea-runner process is already using %q; each runner process needs its own runner file (runner.file)", cfg.Runner.File)
return err
} else if err != nil {
case err != nil:
// Best-effort guard: if the lock file can't be created (e.g. a
// read-only runner-file mount), warn and start anyway rather than
// refusing to run.
log.Warnf("could not lock runner file %q, continuing without the single-process guard: %v", cfg.Runner.File, err)
} else {
default:
// Held until shutdown finishes: the draining runner still owns this
// identity on the server, so releasing early would let a restart
// reintroduce the duplicate-identity job cancellations.
@@ -170,13 +171,14 @@ func runDaemon(ctx context.Context, daemArgs *daemonArgs, configFile *string) fu
// declare the labels of the runner before fetching tasks
resp, err := runner.Declare(ctx, ls.Names())
if err != nil && connect.CodeOf(err) == connect.CodeUnimplemented {
switch {
case err != nil && connect.CodeOf(err) == connect.CodeUnimplemented:
log.Errorf("Your Gitea version is too old to support runner declare, please upgrade to v1.21 or later")
return err
} else if err != nil {
case err != nil:
log.WithError(err).Error("fail to invoke Declare")
return err
} else {
default:
log.Infof("runner: %s, with version: %s, with labels: %v, declare successfully",
resp.Msg.Runner.Name, resp.Msg.Runner.Version, resp.Msg.Runner.Labels)
}