Skip to content

fix(deps): update all non-major dependencies #13829

fix(deps): update all non-major dependencies

fix(deps): update all non-major dependencies #13829

GitHub Actions / golangci failed Jul 4, 2024 in 0s

reviewdog [golangci] report

reported by reviewdog 🐶

Findings (29)

compiler/template/starlark/starlark.go|131 col 4| only one cuddle assignment allowed before if statement (wsl)
database/pipeline/create.go|3| 3-54 lines are duplicate of database/pipeline/update.go:3-55 (dupl)
database/pipeline/update.go|3| 3-55 lines are duplicate of database/pipeline/create.go:3-54 (dupl)
database/deployment/create.go|3| 3-34 lines are duplicate of database/deployment/update.go:3-34 (dupl)
database/deployment/update.go|3| 3-34 lines are duplicate of database/deployment/create.go:3-34 (dupl)
mock/server/schedule.go|3| 3-284 lines are duplicate of mock/server/secret.go:4-181 (dupl)
database/worker/create.go|3| 3-38 lines are duplicate of database/worker/update.go:3-38 (dupl)
database/worker/update.go|3| 3-38 lines are duplicate of database/worker/create.go:3-38 (dupl)
api/pipeline/validate.go|78| 78-109 lines are duplicate of api/pipeline/compile.go:80-111 (dupl)
api/pipeline/validate.go|3| 3-109 lines are duplicate of api/pipeline/expand.go:4-111 (dupl)
compiler/native/expand.go|47| Function 'ExpandSteps' has too many statements (77 > 70) (funlen)
mock/server/authentication.go|81 col 9| string error has 4 occurrences, make it a constant (goconst)
database/executable/pop.go|16 col 37| unused-parameter: parameter 'ctx' seems to be unused, consider removing or renaming it as _ (revive)
database/executable/table.go|38 col 45| unused-parameter: parameter 'ctx' seems to be unused, consider removing or renaming it as _ (revive)
database/executable/clean.go|31 col 40| unused-parameter: parameter 'ctx' seems to be unused, consider removing or renaming it as _ (revive)
scm/github/authentication.go|59 col 52| unused-parameter: parameter 'w' seems to be unused, consider removing or renaming it as _ (revive)
secret/vault/refresh_test.go|45 col 74| unused-parameter: parameter 'r' seems to be unused, consider removing or renaming it as _ (revive)
secret/vault/refresh_test.go|71 col 40| unused-parameter: parameter 'in' seems to be unused, consider removing or renaming it as _ (revive)
secret/vault/refresh_test.go|108 col 40| unused-parameter: parameter 'in' seems to be unused, consider removing or renaming it as _ (revive)
secret/vault/refresh_test.go|128 col 40| unused-parameter: parameter 'in' seems to be unused, consider removing or renaming it as _ (revive)
secret/vault/refresh_test.go|201 col 74| unused-parameter: parameter 'r' seems to be unused, consider removing or renaming it as _ (revive)
router/middleware/logger.go|48 col 36| unused-parameter: parameter 'timeFormat' seems to be unused, consider removing or renaming it as _ (revive)
api/webhook/post.go|193 col 32| Non-inherited new context, use function like context.WithXXX instead (contextcheck)
api/webhook/post.go|596 col 38| Non-inherited new context, use function like context.WithXXX instead (contextcheck)
api/webhook/post.go|607 col 40| Non-inherited new context, use function like context.WithXXX instead (contextcheck)
scm/github/access.go|34 col 28| Function newClientToken should pass the context parameter (contextcheck)
scm/github/access.go|103 col 28| Function newClientToken should pass the context parameter (contextcheck)
scm/github/access.go|153 col 28| Function newClientToken should pass the context parameter (contextcheck)
secret/vault/get.go|40 col 2| directive //nolint:ineffassign,staticcheck // ignore false positive is unused for linter "staticcheck" (nolintlint)

Filtered Findings (0)

Annotations

Check failure on line 131 in compiler/template/starlark/starlark.go

See this annotation in the file changed.

@github-actions github-actions / golangci

[golangci] compiler/template/starlark/starlark.go#L131

only one cuddle assignment allowed before if statement (wsl)
Raw output
compiler/template/starlark/starlark.go:131:4: only one cuddle assignment allowed before if statement (wsl)
			if err != nil {
			^

Check failure on line 3 in database/pipeline/create.go

See this annotation in the file changed.

@github-actions github-actions / golangci

[golangci] database/pipeline/create.go#L3

3-54 lines are duplicate of `database/pipeline/update.go:3-55` (dupl)
Raw output
database/pipeline/create.go:3: 3-54 lines are duplicate of `database/pipeline/update.go:3-55` (dupl)
package pipeline

import (
	"context"

	"github.com/sirupsen/logrus"

	"github.com/go-vela/types/constants"
	"github.com/go-vela/types/database"
	"github.com/go-vela/types/library"
)

// CreatePipeline creates a new pipeline in the database.
func (e *engine) CreatePipeline(ctx context.Context, p *library.Pipeline) (*library.Pipeline, error) {
	e.logger.WithFields(logrus.Fields{
		"pipeline": p.GetCommit(),
	}).Tracef("creating pipeline %s in the database", p.GetCommit())

	// cast the library type to database type
	//
	// https://pkg.go.dev/github.com/go-vela/types/database#PipelineFromLibrary
	pipeline := database.PipelineFromLibrary(p)

	// validate the necessary fields are populated
	//
	// https://pkg.go.dev/github.com/go-vela/types/database#Pipeline.Validate
	err := pipeline.Validate()
	if err != nil {
		return nil, err
	}

	// compress data for the pipeline
	//
	// https://pkg.go.dev/github.com/go-vela/types/database#Pipeline.Compress
	err = pipeline.Compress(e.config.CompressionLevel)
	if err != nil {
		return nil, err
	}

	// send query to the database
	err = e.client.Table(constants.TablePipeline).Create(pipeline).Error
	if err != nil {
		return nil, err
	}

	err = pipeline.Decompress()
	if err != nil {
		return nil, err
	}

	return pipeline.ToLibrary(), nil
}

Check failure on line 3 in database/pipeline/update.go

See this annotation in the file changed.

@github-actions github-actions / golangci

[golangci] database/pipeline/update.go#L3

3-55 lines are duplicate of `database/pipeline/create.go:3-54` (dupl)
Raw output
database/pipeline/update.go:3: 3-55 lines are duplicate of `database/pipeline/create.go:3-54` (dupl)
package pipeline

import (
	"context"

	"github.com/sirupsen/logrus"

	"github.com/go-vela/types/constants"
	"github.com/go-vela/types/database"
	"github.com/go-vela/types/library"
)

// UpdatePipeline updates an existing pipeline in the database.
func (e *engine) UpdatePipeline(ctx context.Context, p *library.Pipeline) (*library.Pipeline, error) {
	e.logger.WithFields(logrus.Fields{
		"pipeline": p.GetCommit(),
	}).Tracef("updating pipeline %s in the database", p.GetCommit())

	// cast the library type to database type
	//
	// https://pkg.go.dev/github.com/go-vela/types/database#PipelineFromLibrary
	pipeline := database.PipelineFromLibrary(p)

	// validate the necessary fields are populated
	//
	// https://pkg.go.dev/github.com/go-vela/types/database#Pipeline.Validate
	err := pipeline.Validate()
	if err != nil {
		return nil, err
	}

	// compress data for the pipeline
	//
	// https://pkg.go.dev/github.com/go-vela/types/database#Pipeline.Compress
	err = pipeline.Compress(e.config.CompressionLevel)
	if err != nil {
		return nil, err
	}

	// send query to the database
	err = e.client.Table(constants.TablePipeline).Save(pipeline).Error
	if err != nil {
		return nil, err
	}

	// decompress pipeline to return
	err = pipeline.Decompress()
	if err != nil {
		return nil, err
	}

	return pipeline.ToLibrary(), nil
}

Check failure on line 3 in database/deployment/create.go

See this annotation in the file changed.

@github-actions github-actions / golangci

[golangci] database/deployment/create.go#L3

3-34 lines are duplicate of `database/deployment/update.go:3-34` (dupl)
Raw output
database/deployment/create.go:3: 3-34 lines are duplicate of `database/deployment/update.go:3-34` (dupl)
package deployment

import (
	"context"

	"github.com/sirupsen/logrus"

	"github.com/go-vela/types/constants"
	"github.com/go-vela/types/database"
	"github.com/go-vela/types/library"
)

// CreateDeployment creates a new deployment in the database.
func (e *engine) CreateDeployment(ctx context.Context, d *library.Deployment) (*library.Deployment, error) {
	e.logger.WithFields(logrus.Fields{
		"deployment": d.GetID(),
	}).Tracef("creating deployment %d", d.GetID())

	// cast the library type to database type
	deployment := database.DeploymentFromLibrary(d)

	// validate the necessary fields are populated
	err := deployment.Validate()
	if err != nil {
		return nil, err
	}

	result := e.client.Table(constants.TableDeployment).Create(deployment)

	// send query to the database
	return deployment.ToLibrary(d.Builds), result.Error
}

Check failure on line 3 in database/deployment/update.go

See this annotation in the file changed.

@github-actions github-actions / golangci

[golangci] database/deployment/update.go#L3

3-34 lines are duplicate of `database/deployment/create.go:3-34` (dupl)
Raw output
database/deployment/update.go:3: 3-34 lines are duplicate of `database/deployment/create.go:3-34` (dupl)
package deployment

import (
	"context"

	"github.com/sirupsen/logrus"

	"github.com/go-vela/types/constants"
	"github.com/go-vela/types/database"
	"github.com/go-vela/types/library"
)

// UpdateDeployment updates an existing deployment in the database.
func (e *engine) UpdateDeployment(ctx context.Context, d *library.Deployment) (*library.Deployment, error) {
	e.logger.WithFields(logrus.Fields{
		"deployment": d.GetID(),
	}).Tracef("updating deployment %d", d.GetID())

	// cast the library type to database type
	deployment := database.DeploymentFromLibrary(d)

	// validate the necessary fields are populated
	err := deployment.Validate()
	if err != nil {
		return nil, err
	}

	result := e.client.Table(constants.TableDeployment).Save(deployment)

	// send query to the database
	return deployment.ToLibrary(d.Builds), result.Error
}

Check failure on line 3 in mock/server/schedule.go

See this annotation in the file changed.

@github-actions github-actions / golangci

[golangci] mock/server/schedule.go#L3

3-284 lines are duplicate of `mock/server/secret.go:4-181` (dupl)
Raw output
mock/server/schedule.go:3: 3-284 lines are duplicate of `mock/server/secret.go:4-181` (dupl)
package server

import (
	"encoding/json"
	"fmt"
	"net/http"
	"strings"

	"github.com/gin-gonic/gin"

	api "github.com/go-vela/server/api/types"
	"github.com/go-vela/types"
)

const (
	// ScheduleResp represents a JSON return for a single schedule.
	ScheduleResp = `{
		"id": 2,
		"repo": {
			"id": 1,
			"owner": {
				"id": 1,
				"name": "octocat",
				"favorites": [],
				"active": true,
				"admin": false
			},
			"org": "github",
			"counter": 10,
			"name": "octocat",
			"full_name": "github/octocat",
			"link": "https://github.com/github/octocat",
			"clone": "https://github.com/github/octocat",
			"branch": "main",
			"build_limit": 10,
			"timeout": 60,
			"visibility": "public",
			"private": false,
			"trusted": true,
			"pipeline_type": "yaml",
			"topics": [],
			"active": true,
			"allow_events": {
				"push": {
					"branch": true,
					"tag": true
				},
				"pull_request": {
					"opened": true,
					"synchronize": true,
					"reopened": true,
					"edited": false
				},
				"deployment": {
					"created": true
				},
				"comment": {
					"created": false,
					"edited": false
				}
			},
			"approve_build": "fork-always",
			"previous_name": ""
		},
		"active": true,
		"name": "foo",
		"entry": "@weekly",
		"created_at": 1683154980,
		"created_by": "octocat",
		"updated_at": 1683154980,
		"updated_by": "octocat",
		"scheduled_at": 0,
		"branch": "main",
		"error": "error message",
		"next_run": 0
	}`
	SchedulesResp = `[
	{
		"id": 2,
		"repo": {
			"id": 1,
			"owner": {
				"id": 1,
				"name": "octocat",
				"favorites": [],
				"active": true,
				"admin": false
			},
			"org": "github",
			"counter": 10,
			"name": "octocat",
			"full_name": "github/octocat",
			"link": "https://github.com/github/octocat",
			"clone": "https://github.com/github/octocat",
			"branch": "main",
			"build_limit": 10,
			"timeout": 60,
			"visibility": "public",
			"private": false,
			"trusted": true,
			"pipeline_type": "yaml",
			"topics": [],
			"active": true,
			"allow_events": {
				"push": {
					"branch": true,
					"tag": true
				},
				"pull_request": {
					"opened": true,
					"synchronize": true,
					"reopened": true,
					"edited": false
				},
				"deployment": {
					"created": true
				},
				"comment": {
					"created": false,
					"edited": false
				}
			},
			"approve_build": "fork-always",
			"previous_name": ""
		},
		"active": true,
		"name": "foo",
		"entry": "@weekly",
		"created_at": 1683154980,
		"created_by": "octocat",
		"updated_at": 1683154980,
		"updated_by": "octocat",
		"scheduled_at": 0,
		"branch": "main",
		"error": "error message",
		"next_run": 0
	},
	{
		"id": 1,
		"repo": {
			"id": 1,
			"owner": {
				"id": 1,
				"name": "octocat",
				"favorites": [],
				"active": true,
				"admin": false
			},
			"org": "github",
			"counter": 10,
			"name": "octocat",
			"full_name": "github/octocat",
			"link": "https://github.com/github/octocat",
			"clone": "https://github.com/github/octocat",
			"branch": "main",
			"build_limit": 10,
			"timeout": 60,
			"visibility": "public",
			"private": false,
			"trusted": true,
			"pipeline_type": "yaml",
			"topics": [],
			"active": true,
			"allow_events": {
				"push": {
					"branch": true,
					"tag": true
				},
				"pull_request": {
					"opened": true,
					"synchronize": true,
					"reopened": true,
					"edited": false
				},
				"deployment": {
					"created": true
				},
				"comment": {
					"created": false,
					"edited": false
				}
			},
			"approve_build": "fork-always",
			"previous_name": ""
		},
		"active": true,
		"name": "bar",
		"entry": "@weekly",
		"created_at": 1683154974,
		"created_by": "octocat",
		"updated_at": 1683154974,
		"updated_by": "octocat",
		"scheduled_at": 0,
		"repo_id": 1,
		"branch": "main",
		"error": "error message",
		"next_run": 0
	}]`
)

// getSchedules returns mock JSON for a http GET.
func getSchedules(c *gin.Context) {
	data := []byte(SchedulesResp)

	var body []api.Schedule
	_ = json.Unmarshal(data, &body)

	c.JSON(http.StatusOK, body)
}

// getSchedule has a param :schedule returns mock JSON for a http GET.
//
// Pass "not-found" to :schedule to test receiving a http 404 response.
func getSchedule(c *gin.Context) {
	s := c.Param("schedule")

	if strings.Contains(s, "not-found") {
		msg := fmt.Sprintf("Schedule %s does not exist", s)

		c.AbortWithStatusJSON(http.StatusNotFound, types.Error{Message: &msg})

		return
	}

	data := []byte(ScheduleResp)

	var body api.Schedule
	_ = json.Unmarshal(data, &body)

	c.JSON(http.StatusOK, body)
}

// addSchedule returns mock JSON for a http POST.
func addSchedule(c *gin.Context) {
	data := []byte(ScheduleResp)

	var body api.Schedule
	_ = json.Unmarshal(data, &body)

	c.JSON(http.StatusCreated, body)
}

// updateSchedule has a param :schedule returns mock JSON for a http PUT.
//
// Pass "not-found" to :schedule to test receiving a http 404 response.
func updateSchedule(c *gin.Context) {
	if !strings.Contains(c.FullPath(), "admin") {
		s := c.Param("schedule")

		if strings.Contains(s, "not-found") {
			msg := fmt.Sprintf("Schedule %s does not exist", s)

			c.AbortWithStatusJSON(http.StatusNotFound, types.Error{Message: &msg})

			return
		}
	}

	data := []byte(ScheduleResp)

	var body api.Schedule
	_ = json.Unmarshal(data, &body)

	c.JSON(http.StatusOK, body)
}

// removeSchedule has a param :schedule returns mock JSON for a http DELETE.
//
// Pass "not-found" to :schedule to test receiving a http 404 response.
func removeSchedule(c *gin.Context) {
	s := c.Param("schedule")

	if strings.Contains(s, "not-found") {
		msg := fmt.Sprintf("Schedule %s does not exist", s)

		c.AbortWithStatusJSON(http.StatusNotFound, types.Error{Message: &msg})

		return
	}

	c.JSON(http.StatusOK, fmt.Sprintf("schedule %s deleted", s))
}

Check failure on line 3 in database/worker/create.go

See this annotation in the file changed.

@github-actions github-actions / golangci

[golangci] database/worker/create.go#L3

3-38 lines are duplicate of `database/worker/update.go:3-38` (dupl)
Raw output
database/worker/create.go:3: 3-38 lines are duplicate of `database/worker/update.go:3-38` (dupl)
package worker

import (
	"context"

	"github.com/sirupsen/logrus"

	api "github.com/go-vela/server/api/types"
	"github.com/go-vela/server/database/types"
	"github.com/go-vela/types/constants"
)

// CreateWorker creates a new worker in the database.
func (e *engine) CreateWorker(ctx context.Context, w *api.Worker) (*api.Worker, error) {
	e.logger.WithFields(logrus.Fields{
		"worker": w.GetHostname(),
	}).Tracef("creating worker %s", w.GetHostname())

	// cast the library type to database type
	//
	// https://pkg.go.dev/github.com/go-vela/types/database#WorkerFromLibrary
	worker := types.WorkerFromAPI(w)

	// validate the necessary fields are populated
	//
	// https://pkg.go.dev/github.com/go-vela/types/database#Worker.Validate
	err := worker.Validate()
	if err != nil {
		return nil, err
	}

	// send query to the database
	result := e.client.Table(constants.TableWorker).Create(worker)

	return worker.ToAPI(w.GetRunningBuilds()), result.Error
}

Check failure on line 3 in database/worker/update.go

See this annotation in the file changed.

@github-actions github-actions / golangci

[golangci] database/worker/update.go#L3

3-38 lines are duplicate of `database/worker/create.go:3-38` (dupl)
Raw output
database/worker/update.go:3: 3-38 lines are duplicate of `database/worker/create.go:3-38` (dupl)
package worker

import (
	"context"

	"github.com/sirupsen/logrus"

	api "github.com/go-vela/server/api/types"
	"github.com/go-vela/server/database/types"
	"github.com/go-vela/types/constants"
)

// UpdateWorker updates an existing worker in the database.
func (e *engine) UpdateWorker(ctx context.Context, w *api.Worker) (*api.Worker, error) {
	e.logger.WithFields(logrus.Fields{
		"worker": w.GetHostname(),
	}).Tracef("updating worker %s", w.GetHostname())

	// cast the library type to database type
	//
	// https://pkg.go.dev/github.com/go-vela/types/database#WorkerFromLibrary
	worker := types.WorkerFromAPI(w)

	// validate the necessary fields are populated
	//
	// https://pkg.go.dev/github.com/go-vela/types/database#Worker.Validate
	err := worker.Validate()
	if err != nil {
		return nil, err
	}

	// send query to the database
	result := e.client.Table(constants.TableWorker).Save(worker)

	return worker.ToAPI(w.GetRunningBuilds()), result.Error
}

Check failure on line 78 in api/pipeline/validate.go

See this annotation in the file changed.

@github-actions github-actions / golangci

[golangci] api/pipeline/validate.go#L78

78-109 lines are duplicate of `api/pipeline/compile.go:80-111` (dupl)
Raw output
api/pipeline/validate.go:78: 78-109 lines are duplicate of `api/pipeline/compile.go:80-111` (dupl)
func ValidatePipeline(c *gin.Context) {
	// capture middleware values
	m := c.MustGet("metadata").(*internal.Metadata)
	l := c.MustGet("logger").(*logrus.Entry)
	p := pipeline.Retrieve(c)
	r := repo.Retrieve(c)
	u := user.Retrieve(c)

	entry := fmt.Sprintf("%s/%s", r.GetFullName(), p.GetCommit())

	l.Debugf("validating pipeline %s", entry)

	// ensure we use the expected pipeline type when compiling
	r.SetPipelineType(p.GetType())

	// create the compiler object
	compiler := compiler.FromContext(c).Duplicate().WithCommit(p.GetCommit()).WithMetadata(m).WithRepo(r).WithUser(u)

	ruleData := prepareRuleData(c)

	// validate the pipeline
	pipeline, _, err := compiler.CompileLite(p.GetData(), ruleData, false)
	if err != nil {
		retErr := fmt.Errorf("unable to validate pipeline %s: %w", entry, err)

		util.HandleError(c, http.StatusBadRequest, retErr)

		return
	}

	writeOutput(c, pipeline)
}

Check failure on line 3 in api/pipeline/validate.go

See this annotation in the file changed.

@github-actions github-actions / golangci

[golangci] api/pipeline/validate.go#L3

3-109 lines are duplicate of `api/pipeline/expand.go:4-111` (dupl)
Raw output
api/pipeline/validate.go:3: 3-109 lines are duplicate of `api/pipeline/expand.go:4-111` (dupl)
package pipeline

import (
	"fmt"
	"net/http"

	"github.com/gin-gonic/gin"
	"github.com/sirupsen/logrus"

	"github.com/go-vela/server/compiler"
	"github.com/go-vela/server/internal"
	"github.com/go-vela/server/router/middleware/pipeline"
	"github.com/go-vela/server/router/middleware/repo"
	"github.com/go-vela/server/router/middleware/user"
	"github.com/go-vela/server/util"
)

// swagger:operation POST /api/v1/pipelines/{org}/{repo}/{pipeline}/validate pipelines ValidatePipeline
//
// Get, expand and validate a pipeline
//
// ---
// produces:
// - application/yaml
// - application/json
// parameters:
// - in: path
//   name: org
//   description: Name of the organization
//   required: true
//   type: string
// - in: path
//   name: repo
//   description: Name of the repository
//   required: true
//   type: string
// - in: path
//   name: pipeline
//   description: Commit SHA for pipeline to retrieve
//   required: true
//   type: string
// - in: query
//   name: output
//   description: Output string for specifying output format
//   type: string
//   default: yaml
//   enum:
//   - json
//   - yaml
// security:
//   - ApiKeyAuth: []
// responses:
//   '200':
//     description: Successfully retrieved, expanded and validated the pipeline
//     schema:
//       type: string
//   '400':
//     description: Invalid request payload or path
//     schema:
//       "$ref": "#/definitions/Error"
//   '401':
//     description: Unauthorized
//     schema:
//       "$ref": "#/definitions/Error"
//   '404':
//     description: Not found
//     schema:
//       "$ref": "#/definitions/Error"
//   '500':
//     description: Unexpected server error
//     schema:
//       "$ref": "#/definitions/Error"

// ValidatePipeline represents the API handler to capture,
// expand and validate a pipeline configuration.
func ValidatePipeline(c *gin.Context) {
	// capture middleware values
	m := c.MustGet("metadata").(*internal.Metadata)
	l := c.MustGet("logger").(*logrus.Entry)
	p := pipeline.Retrieve(c)
	r := repo.Retrieve(c)
	u := user.Retrieve(c)

	entry := fmt.Sprintf("%s/%s", r.GetFullName(), p.GetCommit())

	l.Debugf("validating pipeline %s", entry)

	// ensure we use the expected pipeline type when compiling
	r.SetPipelineType(p.GetType())

	// create the compiler object
	compiler := compiler.FromContext(c).Duplicate().WithCommit(p.GetCommit()).WithMetadata(m).WithRepo(r).WithUser(u)

	ruleData := prepareRuleData(c)

	// validate the pipeline
	pipeline, _, err := compiler.CompileLite(p.GetData(), ruleData, false)
	if err != nil {
		retErr := fmt.Errorf("unable to validate pipeline %s: %w", entry, err)

		util.HandleError(c, http.StatusBadRequest, retErr)

		return
	}

	writeOutput(c, pipeline)
}

Check failure on line 47 in compiler/native/expand.go

See this annotation in the file changed.

@github-actions github-actions / golangci

[golangci] compiler/native/expand.go#L47

Function 'ExpandSteps' has too many statements (77 > 70) (funlen)
Raw output
compiler/native/expand.go:47: Function 'ExpandSteps' has too many statements (77 > 70) (funlen)
func (c *client) ExpandSteps(s *yaml.Build, tmpls map[string]*yaml.Template, r *pipeline.RuleData, depth int) (*yaml.Build, error) {

Check failure on line 81 in mock/server/authentication.go

See this annotation in the file changed.

@github-actions github-actions / golangci

[golangci] mock/server/authentication.go#L81

string `error` has 4 occurrences, make it a constant (goconst)
Raw output
mock/server/authentication.go:81:9: string `error` has 4 occurrences, make it a constant (goconst)
	err := "error"
	       ^

Check failure on line 16 in database/executable/pop.go

See this annotation in the file changed.

@github-actions github-actions / golangci

[golangci] database/executable/pop.go#L16

unused-parameter: parameter 'ctx' seems to be unused, consider removing or renaming it as _ (revive)
Raw output
database/executable/pop.go:16:37: unused-parameter: parameter 'ctx' seems to be unused, consider removing or renaming it as _ (revive)
func (e *engine) PopBuildExecutable(ctx context.Context, id int64) (*library.BuildExecutable, error) {
                                    ^

Check failure on line 38 in database/executable/table.go

See this annotation in the file changed.

@github-actions github-actions / golangci

[golangci] database/executable/table.go#L38

unused-parameter: parameter 'ctx' seems to be unused, consider removing or renaming it as _ (revive)
Raw output
database/executable/table.go:38:45: unused-parameter: parameter 'ctx' seems to be unused, consider removing or renaming it as _ (revive)
func (e *engine) CreateBuildExecutableTable(ctx context.Context, driver string) error {
                                            ^

Check failure on line 31 in database/executable/clean.go

See this annotation in the file changed.

@github-actions github-actions / golangci

[golangci] database/executable/clean.go#L31

unused-parameter: parameter 'ctx' seems to be unused, consider removing or renaming it as _ (revive)
Raw output
database/executable/clean.go:31:40: unused-parameter: parameter 'ctx' seems to be unused, consider removing or renaming it as _ (revive)
func (e *engine) CleanBuildExecutables(ctx context.Context) (int64, error) {
                                       ^

Check failure on line 59 in scm/github/authentication.go

See this annotation in the file changed.

@github-actions github-actions / golangci

[golangci] scm/github/authentication.go#L59

unused-parameter: parameter 'w' seems to be unused, consider removing or renaming it as _ (revive)
Raw output
scm/github/authentication.go:59:52: unused-parameter: parameter 'w' seems to be unused, consider removing or renaming it as _ (revive)
func (c *client) Authenticate(ctx context.Context, w http.ResponseWriter, r *http.Request, oAuthState string) (*api.User, error) {
                                                   ^

Check failure on line 45 in secret/vault/refresh_test.go

See this annotation in the file changed.

@github-actions github-actions / golangci

[golangci] secret/vault/refresh_test.go#L45

unused-parameter: parameter 'r' seems to be unused, consider removing or renaming it as _ (revive)
Raw output
secret/vault/refresh_test.go:45:74: unused-parameter: parameter 'r' seems to be unused, consider removing or renaming it as _ (revive)
			ts := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
			                                                                      ^

Check failure on line 71 in secret/vault/refresh_test.go

See this annotation in the file changed.

@github-actions github-actions / golangci

[golangci] secret/vault/refresh_test.go#L71

unused-parameter: parameter 'in' seems to be unused, consider removing or renaming it as _ (revive)
Raw output
secret/vault/refresh_test.go:71:40: unused-parameter: parameter 'in' seems to be unused, consider removing or renaming it as _ (revive)
				mockGetCallerIdentityRequest: func(in *sts.GetCallerIdentityInput) (*request.Request, *sts.GetCallerIdentityOutput) {
				                                   ^

Check failure on line 108 in secret/vault/refresh_test.go

See this annotation in the file changed.

@github-actions github-actions / golangci

[golangci] secret/vault/refresh_test.go#L108

unused-parameter: parameter 'in' seems to be unused, consider removing or renaming it as _ (revive)
Raw output
secret/vault/refresh_test.go:108:40: unused-parameter: parameter 'in' seems to be unused, consider removing or renaming it as _ (revive)
				mockGetCallerIdentityRequest: func(in *sts.GetCallerIdentityInput) (*request.Request, *sts.GetCallerIdentityOutput) {
				                                   ^

Check failure on line 128 in secret/vault/refresh_test.go

See this annotation in the file changed.

@github-actions github-actions / golangci

[golangci] secret/vault/refresh_test.go#L128

unused-parameter: parameter 'in' seems to be unused, consider removing or renaming it as _ (revive)
Raw output
secret/vault/refresh_test.go:128:40: unused-parameter: parameter 'in' seems to be unused, consider removing or renaming it as _ (revive)
				mockGetCallerIdentityRequest: func(in *sts.GetCallerIdentityInput) (*request.Request, *sts.GetCallerIdentityOutput) {
				                                   ^

Check failure on line 201 in secret/vault/refresh_test.go

See this annotation in the file changed.

@github-actions github-actions / golangci

[golangci] secret/vault/refresh_test.go#L201

unused-parameter: parameter 'r' seems to be unused, consider removing or renaming it as _ (revive)
Raw output
secret/vault/refresh_test.go:201:74: unused-parameter: parameter 'r' seems to be unused, consider removing or renaming it as _ (revive)
			ts := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
			                                                                      ^

Check failure on line 48 in router/middleware/logger.go

See this annotation in the file changed.

@github-actions github-actions / golangci

[golangci] router/middleware/logger.go#L48

unused-parameter: parameter 'timeFormat' seems to be unused, consider removing or renaming it as _ (revive)
Raw output
router/middleware/logger.go:48:36: unused-parameter: parameter 'timeFormat' seems to be unused, consider removing or renaming it as _ (revive)
func Logger(logger *logrus.Logger, timeFormat string) gin.HandlerFunc {
                                   ^

Check failure on line 193 in api/webhook/post.go

See this annotation in the file changed.

@github-actions github-actions / golangci

[golangci] api/webhook/post.go#L193

Non-inherited new context, use function like `context.WithXXX` instead (contextcheck)
Raw output
api/webhook/post.go:193:32: Non-inherited new context, use function like `context.WithXXX` instead (contextcheck)
		_, err = database.FromContext(c).UpdateHook(ctx, h)
		                             ^

Check failure on line 596 in api/webhook/post.go

See this annotation in the file changed.

@github-actions github-actions / golangci

[golangci] api/webhook/post.go#L596

Non-inherited new context, use function like `context.WithXXX` instead (contextcheck)
Raw output
api/webhook/post.go:596:38: Non-inherited new context, use function like `context.WithXXX` instead (contextcheck)
		dbRepo, err := database.FromContext(c).GetRepoForOrg(ctx, r.GetOrg(), r.GetName())
		                                   ^

Check failure on line 607 in api/webhook/post.go

See this annotation in the file changed.

@github-actions github-actions / golangci

[golangci] api/webhook/post.go#L607

Non-inherited new context, use function like `context.WithXXX` instead (contextcheck)
Raw output
api/webhook/post.go:607:40: Non-inherited new context, use function like `context.WithXXX` instead (contextcheck)
		lastHook, err := database.FromContext(c).LastHookForRepo(ctx, dbRepo)
		                                     ^