Fix linter (#3354)

This commit is contained in:
Anbraten 2024-02-08 22:49:07 +01:00 committed by GitHub
parent 832f49a164
commit 0b91317cde
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
9 changed files with 14 additions and 14 deletions

View file

@ -230,7 +230,7 @@ func (e *kube) WaitStep(ctx context.Context, step *types.Step, taskUUID string)
finished := make(chan bool)
podUpdated := func(old, new any) {
podUpdated := func(_, new any) {
pod, ok := new.(*v1.Pod)
if !ok {
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)
podUpdated := func(old, new any) {
podUpdated := func(_, new any) {
pod, ok := new.(*v1.Pod)
if !ok {
log.Error().Msgf("could not parse pod: %v", new)

View file

@ -36,7 +36,7 @@ func WithOption(option Option, b bool) Option {
case b:
return option
default:
return func(compiler *Compiler) {}
return func(_ *Compiler) {}
}
}

View file

@ -42,10 +42,10 @@ func TestLogging(t *testing.T) {
logger := New()
assert.NoError(t, logger.Open(ctx, testStepID))
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() {
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)
@ -60,7 +60,7 @@ func TestLogging(t *testing.T) {
wg.Add(1)
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)

View file

@ -38,7 +38,7 @@ func queuePipeline(ctx context.Context, repo *model.Repo, pipelineItems []*stepb
task.Labels[k] = v
}
task.Labels["repo"] = repo.FullName
task.Dependencies = taskIds(item.DependsOn, pipelineItems)
task.Dependencies = taskIDs(item.DependsOn, pipelineItems)
task.RunOn = item.RunsOn
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)
}
func taskIds(dependsOn []string, pipelineItems []*stepbuilder.Item) (taskIds []string) {
func taskIDs(dependsOn []string, pipelineItems []*stepbuilder.Item) (taskIDs []string) {
for _, dep := range dependsOn {
for _, pipelineItem := range pipelineItems {
if pipelineItem.Workflow.Name == dep {
taskIds = append(taskIds, fmt.Sprint(pipelineItem.Workflow.ID))
taskIDs = append(taskIDs, fmt.Sprint(pipelineItem.Workflow.ID))
}
}
}

View file

@ -41,7 +41,7 @@ func TestPubsub(t *testing.T) {
broker.Subscribe(ctx, func(message Message) { assert.Equal(t, testMessage, message); wg.Done() })
}()
go func() {
broker.Subscribe(ctx, func(message Message) { wg.Done() })
broker.Subscribe(ctx, func(_ Message) { wg.Done() })
}()
<-time.After(500 * time.Millisecond)

View file

@ -29,7 +29,7 @@ func AuthorizeAgent(c *gin.Context) {
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
})
switch {

View file

@ -55,7 +55,7 @@ func SetUser() gin.HandlerFunc {
// this means the user is accessing with a web browser,
// so we should implement CSRF protection measures.
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
})
// if csrf token validation fails, exit immediately

View file

@ -90,7 +90,7 @@ func Migrate(e *xorm.Engine, allowLong bool) error {
if oldCount < 1 || 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`
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
return nil
})

View file

@ -26,7 +26,7 @@ import (
)
func Test_QueueInfo(t *testing.T) {
fixtureHandler := func(w http.ResponseWriter, r *http.Request) {
fixtureHandler := func(w http.ResponseWriter, _ *http.Request) {
fmt.Fprint(w, `{
"pending": null,
"running": [