mirror of
https://github.com/woodpecker-ci/woodpecker.git
synced 2024-11-22 09:51:01 +00:00
Fix linter (#3354)
This commit is contained in:
parent
832f49a164
commit
0b91317cde
9 changed files with 14 additions and 14 deletions
|
@ -230,7 +230,7 @@ func (e *kube) WaitStep(ctx context.Context, step *types.Step, taskUUID string)
|
||||||
|
|
||||||
finished := make(chan bool)
|
finished := make(chan bool)
|
||||||
|
|
||||||
podUpdated := func(old, new any) {
|
podUpdated := func(_, new any) {
|
||||||
pod, ok := new.(*v1.Pod)
|
pod, ok := new.(*v1.Pod)
|
||||||
if !ok {
|
if !ok {
|
||||||
log.Error().Msgf("could not parse pod: %v", new)
|
log.Error().Msgf("could not parse pod: %v", new)
|
||||||
|
@ -307,7 +307,7 @@ func (e *kube) TailStep(ctx context.Context, step *types.Step, taskUUID string)
|
||||||
|
|
||||||
up := make(chan bool)
|
up := make(chan bool)
|
||||||
|
|
||||||
podUpdated := func(old, new any) {
|
podUpdated := func(_, new any) {
|
||||||
pod, ok := new.(*v1.Pod)
|
pod, ok := new.(*v1.Pod)
|
||||||
if !ok {
|
if !ok {
|
||||||
log.Error().Msgf("could not parse pod: %v", new)
|
log.Error().Msgf("could not parse pod: %v", new)
|
||||||
|
|
|
@ -36,7 +36,7 @@ func WithOption(option Option, b bool) Option {
|
||||||
case b:
|
case b:
|
||||||
return option
|
return option
|
||||||
default:
|
default:
|
||||||
return func(compiler *Compiler) {}
|
return func(_ *Compiler) {}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -42,10 +42,10 @@ func TestLogging(t *testing.T) {
|
||||||
logger := New()
|
logger := New()
|
||||||
assert.NoError(t, logger.Open(ctx, testStepID))
|
assert.NoError(t, logger.Open(ctx, testStepID))
|
||||||
go func() {
|
go func() {
|
||||||
assert.NoError(t, logger.Tail(ctx, testStepID, func(entry ...*model.LogEntry) { wg.Done() }))
|
assert.NoError(t, logger.Tail(ctx, testStepID, func(_ ...*model.LogEntry) { wg.Done() }))
|
||||||
}()
|
}()
|
||||||
go func() {
|
go func() {
|
||||||
assert.NoError(t, logger.Tail(ctx, testStepID, func(entry ...*model.LogEntry) { wg.Done() }))
|
assert.NoError(t, logger.Tail(ctx, testStepID, func(_ ...*model.LogEntry) { wg.Done() }))
|
||||||
}()
|
}()
|
||||||
|
|
||||||
<-time.After(500 * time.Millisecond)
|
<-time.After(500 * time.Millisecond)
|
||||||
|
@ -60,7 +60,7 @@ func TestLogging(t *testing.T) {
|
||||||
|
|
||||||
wg.Add(1)
|
wg.Add(1)
|
||||||
go func() {
|
go func() {
|
||||||
assert.NoError(t, logger.Tail(ctx, testStepID, func(entry ...*model.LogEntry) { wg.Done() }))
|
assert.NoError(t, logger.Tail(ctx, testStepID, func(_ ...*model.LogEntry) { wg.Done() }))
|
||||||
}()
|
}()
|
||||||
|
|
||||||
<-time.After(500 * time.Millisecond)
|
<-time.After(500 * time.Millisecond)
|
||||||
|
|
|
@ -38,7 +38,7 @@ func queuePipeline(ctx context.Context, repo *model.Repo, pipelineItems []*stepb
|
||||||
task.Labels[k] = v
|
task.Labels[k] = v
|
||||||
}
|
}
|
||||||
task.Labels["repo"] = repo.FullName
|
task.Labels["repo"] = repo.FullName
|
||||||
task.Dependencies = taskIds(item.DependsOn, pipelineItems)
|
task.Dependencies = taskIDs(item.DependsOn, pipelineItems)
|
||||||
task.RunOn = item.RunsOn
|
task.RunOn = item.RunsOn
|
||||||
task.DepStatus = make(map[string]model.StatusValue)
|
task.DepStatus = make(map[string]model.StatusValue)
|
||||||
|
|
||||||
|
@ -57,11 +57,11 @@ func queuePipeline(ctx context.Context, repo *model.Repo, pipelineItems []*stepb
|
||||||
return server.Config.Services.Queue.PushAtOnce(ctx, tasks)
|
return server.Config.Services.Queue.PushAtOnce(ctx, tasks)
|
||||||
}
|
}
|
||||||
|
|
||||||
func taskIds(dependsOn []string, pipelineItems []*stepbuilder.Item) (taskIds []string) {
|
func taskIDs(dependsOn []string, pipelineItems []*stepbuilder.Item) (taskIDs []string) {
|
||||||
for _, dep := range dependsOn {
|
for _, dep := range dependsOn {
|
||||||
for _, pipelineItem := range pipelineItems {
|
for _, pipelineItem := range pipelineItems {
|
||||||
if pipelineItem.Workflow.Name == dep {
|
if pipelineItem.Workflow.Name == dep {
|
||||||
taskIds = append(taskIds, fmt.Sprint(pipelineItem.Workflow.ID))
|
taskIDs = append(taskIDs, fmt.Sprint(pipelineItem.Workflow.ID))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -41,7 +41,7 @@ func TestPubsub(t *testing.T) {
|
||||||
broker.Subscribe(ctx, func(message Message) { assert.Equal(t, testMessage, message); wg.Done() })
|
broker.Subscribe(ctx, func(message Message) { assert.Equal(t, testMessage, message); wg.Done() })
|
||||||
}()
|
}()
|
||||||
go func() {
|
go func() {
|
||||||
broker.Subscribe(ctx, func(message Message) { wg.Done() })
|
broker.Subscribe(ctx, func(_ Message) { wg.Done() })
|
||||||
}()
|
}()
|
||||||
|
|
||||||
<-time.After(500 * time.Millisecond)
|
<-time.After(500 * time.Millisecond)
|
||||||
|
|
|
@ -29,7 +29,7 @@ func AuthorizeAgent(c *gin.Context) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
parsed, err := token.ParseRequest(c.Request, func(t *token.Token) (string, error) {
|
parsed, err := token.ParseRequest(c.Request, func(_ *token.Token) (string, error) {
|
||||||
return secret, nil
|
return secret, nil
|
||||||
})
|
})
|
||||||
switch {
|
switch {
|
||||||
|
|
|
@ -55,7 +55,7 @@ func SetUser() gin.HandlerFunc {
|
||||||
// this means the user is accessing with a web browser,
|
// this means the user is accessing with a web browser,
|
||||||
// so we should implement CSRF protection measures.
|
// so we should implement CSRF protection measures.
|
||||||
if t.Kind == token.SessToken {
|
if t.Kind == token.SessToken {
|
||||||
err = token.CheckCsrf(c.Request, func(t *token.Token) (string, error) {
|
err = token.CheckCsrf(c.Request, func(_ *token.Token) (string, error) {
|
||||||
return user.Hash, nil
|
return user.Hash, nil
|
||||||
})
|
})
|
||||||
// if csrf token validation fails, exit immediately
|
// if csrf token validation fails, exit immediately
|
||||||
|
|
|
@ -90,7 +90,7 @@ func Migrate(e *xorm.Engine, allowLong bool) error {
|
||||||
if oldCount < 1 || err != nil {
|
if oldCount < 1 || err != nil {
|
||||||
// allow new schema initialization if old migrations table is empty or it does not exist (err != nil)
|
// allow new schema initialization if old migrations table is empty or it does not exist (err != nil)
|
||||||
// schema initialization will always run if we call `InitSchema`
|
// schema initialization will always run if we call `InitSchema`
|
||||||
m.InitSchema(func(engine *xorm.Engine) error {
|
m.InitSchema(func(_ *xorm.Engine) error {
|
||||||
// do nothing on schema init, models are synced in any case below
|
// do nothing on schema init, models are synced in any case below
|
||||||
return nil
|
return nil
|
||||||
})
|
})
|
||||||
|
|
|
@ -26,7 +26,7 @@ import (
|
||||||
)
|
)
|
||||||
|
|
||||||
func Test_QueueInfo(t *testing.T) {
|
func Test_QueueInfo(t *testing.T) {
|
||||||
fixtureHandler := func(w http.ResponseWriter, r *http.Request) {
|
fixtureHandler := func(w http.ResponseWriter, _ *http.Request) {
|
||||||
fmt.Fprint(w, `{
|
fmt.Fprint(w, `{
|
||||||
"pending": null,
|
"pending": null,
|
||||||
"running": [
|
"running": [
|
||||||
|
|
Loading…
Reference in a new issue