mirror of
https://gitea.com/gitea/act_runner.git
synced 2025-06-12 09:37:14 +02:00
ci(lint): refactor code for clarity and linting compliance (#289)
- Removed `deadcode`, `structcheck`, and `varcheck` linters from `.golangci.yml` - Fixed a typo in a comment in `daemon.go` - Renamed `defaultActionsUrl` to `defaultActionsURL` in `exec.go` - Removed unnecessary else clause in `exec.go` and `runner.go` - Simplified variable initialization in `exec.go` - Changed function name from `getHttpClient` to `getHTTPClient` in `http.go` - Removed unnecessary else clause in `labels_test.go` Signed-off-by: Bo-Yi Wu <appleboy.tw@gmail.com> Reviewed-on: https://gitea.com/gitea/act_runner/pulls/289 Co-authored-by: Bo-Yi Wu <appleboy.tw@gmail.com> Co-committed-by: Bo-Yi Wu <appleboy.tw@gmail.com>
This commit is contained in:
@ -91,10 +91,9 @@ func NewRunner(cfg *config.Config, reg *config.Registration, cli client.Client)
|
||||
func (r *Runner) Run(ctx context.Context, task *runnerv1.Task) error {
|
||||
if _, ok := r.runningTasks.Load(task.Id); ok {
|
||||
return fmt.Errorf("task %d is already running", task.Id)
|
||||
} else {
|
||||
r.runningTasks.Store(task.Id, struct{}{})
|
||||
defer r.runningTasks.Delete(task.Id)
|
||||
}
|
||||
r.runningTasks.Store(task.Id, struct{}{})
|
||||
defer r.runningTasks.Delete(task.Id)
|
||||
|
||||
ctx, cancel := context.WithTimeout(ctx, r.cfg.Runner.Timeout)
|
||||
defer cancel()
|
||||
|
Reference in New Issue
Block a user