mirror of
https://github.com/woodpecker-ci/woodpecker.git
synced 2026-02-13 21:00:00 +00:00
Modernize a couple of loops, fix incorrect function docs (#5637)
This commit is contained in:
@@ -283,8 +283,8 @@ func run(ctx context.Context, c *cli.Command, backends []types.Backend) error {
|
||||
}
|
||||
})
|
||||
|
||||
for i := 0; i < maxWorkflows; i++ {
|
||||
i := i
|
||||
// https://go.dev/blog/go1.22 fixed scope for goroutines in loops
|
||||
for i := range maxWorkflows {
|
||||
serviceWaitingGroup.Go(func() error {
|
||||
runner := agent.NewRunner(client, filter, hostname, counter, &backendEngine)
|
||||
log.Debug().Msgf("created new runner %d", i)
|
||||
|
||||
@@ -28,7 +28,7 @@ const (
|
||||
LogEntryProgress
|
||||
)
|
||||
|
||||
// Line is a line of console output.
|
||||
// LogEntry is a line of console output.
|
||||
type LogEntry struct {
|
||||
StepUUID string `json:"step_uuid,omitempty"`
|
||||
Time int64 `json:"time,omitempty"`
|
||||
|
||||
@@ -28,7 +28,7 @@ type JWTManager struct {
|
||||
tokenDuration time.Duration
|
||||
}
|
||||
|
||||
// UserClaims is a custom JWT claims that contains some user's information.
|
||||
// AgentTokenClaims is a custom JWT claims that contains an agent's information.
|
||||
type AgentTokenClaims struct {
|
||||
jwt.RegisteredClaims
|
||||
AgentID int64 `json:"agent_id"`
|
||||
|
||||
@@ -21,6 +21,7 @@ import (
|
||||
"encoding/json"
|
||||
"errors"
|
||||
"fmt"
|
||||
"maps"
|
||||
"strconv"
|
||||
"time"
|
||||
|
||||
@@ -73,9 +74,7 @@ func (s *RPC) Next(c context.Context, agentFilter rpc.Filter) (*rpc.Workflow, er
|
||||
}
|
||||
|
||||
// enforce labels from server by overwriting agent labels
|
||||
for k, v := range agentServerLabels {
|
||||
agentFilter.Labels[k] = v
|
||||
}
|
||||
maps.Copy(agentFilter.Labels, agentServerLabels)
|
||||
|
||||
log.Trace().Msgf("Agent %s[%d] tries to pull task with labels: %v", agent.Name, agent.ID, agentFilter.Labels)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user