fix(deps): update module github.com/google/go-github/v55 to v56 #11352
reviewdog [golangci] report
reported by reviewdog 🐶
Findings (59)
router/middleware/scm_test.go|12 col 2| could not import github.com/go-vela/server/scm/github (-: # github.com/go-vela/server/scm/github
scm/github/repo.go|558 col 86| cannot use true (untyped bool constant) as int value in argument to client.Repositories.GetBranch) (typecheck)
router/middleware/perm/perm_test.go|22 col 2| could not import github.com/go-vela/server/scm/github (-: # github.com/go-vela/server/scm/github
scm/github/repo.go|558 col 86| cannot use true (untyped bool constant) as int value in argument to client.Repositories.GetBranch) (typecheck)
router/middleware/pipeline/pipeline_test.go|25 col 2| could not import github.com/go-vela/server/scm/github (-: # github.com/go-vela/server/scm/github
scm/github/repo.go|558 col 86| cannot use true (untyped bool constant) as int value in argument to client.Repositories.GetBranch) (typecheck)
scm/github/access.go|1| : # github.com/go-vela/server/scm/github [github.com/go-vela/server/scm/github.test]
scm/github/repo.go|558 col 86| cannot use true (untyped bool constant) as int value in argument to client.Repositories.GetBranch (typecheck)
queue/redis/redis_test.go|95 col 2| _steps
is unused (deadcode)
database/pipeline/create.go|3| 3-53 lines are duplicate of database/pipeline/update.go:3-54
(dupl)
database/pipeline/update.go|3| 3-54 lines are duplicate of database/pipeline/create.go:3-53
(dupl)
mock/server/schedule.go|3| 3-211 lines are duplicate of mock/server/secret.go:4-167
(dupl)
secret/native/count_test.go|36 col 18| Error return value of db.DeleteSecret
is not checked (errcheck)
secret/native/create_test.go|39 col 18| Error return value of db.DeleteSecret
is not checked (errcheck)
secret/native/create_test.go|86 col 18| Error return value of db.DeleteSecret
is not checked (errcheck)
internal/token/refresh_test.go|54 col 16| Error return value of db.DeleteUser
is not checked (errcheck)
internal/token/refresh_test.go|115 col 16| Error return value of db.DeleteUser
is not checked (errcheck)
router/middleware/worker/worker_test.go|60 col 18| Error return value of db.DeleteWorker
is not checked (errcheck)
router/middleware/claims/claims_test.go|276 col 16| Error return value of db.DeleteUser
is not checked (errcheck)
router/middleware/org/org_test.go|67 col 16| Error return value of db.DeleteRepo
is not checked (errcheck)
router/middleware/repo/repo_test.go|74 col 16| Error return value of db.DeleteRepo
is not checked (errcheck)
router/middleware/build/build_test.go|91 col 17| Error return value of db.DeleteBuild
is not checked (errcheck)
router/middleware/build/build_test.go|92 col 16| Error return value of db.DeleteRepo
is not checked (errcheck)
router/middleware/service/service_test.go|80 col 17| Error return value of db.DeleteBuild
is not checked (errcheck)
router/middleware/service/service_test.go|82 col 19| Error return value of db.DeleteService
is not checked (errcheck)
router/middleware/service/service_test.go|222 col 17| Error return value of db.DeleteBuild
is not checked (errcheck)
router/middleware/step/step_test.go|84 col 16| Error return value of db.DeleteStep
is not checked (errcheck)
compiler/native/expand.go|48| Function 'ExpandSteps' has too many statements (71 > 70) (funlen)
mock/server/authentication.go|41 col 9| string error
has 4 occurrences, make it a constant (goconst)
database/database.go|82 col 13| Comment should end in a period (godot)
database/resource.go|1 col 4| Actual: Copyright (c) 2023 Target Brands, Ine. All rights reserved.
database/validate.go|1 col 4| Actual: Copyright (c) 2023 Target Brands, Ine. All rights reserved.
database/validate_test.go|1 col 4| Actual: Copyright (c) 2023 Target Brands, Ine. All rights reserved.
api/queue/queue.go|1 col 4| Actual: Copyright (c) 2023 Target Brands, Inc. All rights reserved.
database/schedule/count.go|6| File is not goimports
-ed (goimports)
database/schedule/count_active.go|6| File is not goimports
-ed (goimports)
database/schedule/count_repo.go|6| File is not goimports
-ed (goimports)
queue/redis/route_test.go|62 col 28| G601: Implicit memory aliasing in for loop. (gosec)
compiler/native/compile_test.go|1808 col 50| G601: Implicit memory aliasing in for loop. (gosec)
compiler/native/compile_test.go|3112 col 51| G601: Implicit memory aliasing in for loop. (gosec)
database/hook/index.go|19 col 36| unused-parameter: parameter 'ctx' seems to be unused, consider removing or renaming it as _ (revive)
database/hook/get_webhook.go|14 col 37| unused-parameter: parameter 'ctx' seems to be unused, consider removing or renaming it as _ (revive)
database/hook/last_repo.go|18 col 34| unused-parameter: parameter 'ctx' seems to be unused, consider removing or renaming it as _ (revive)
database/repo/repo_test.go|211 col 28| unused-parameter: parameter 'v' seems to be unused, consider removing or renaming it as _ (revive)
database/pipeline/pipeline_test.go|207 col 28| unused-parameter: parameter 'v' seems to be unused, consider removing or renaming it as _ (revive)
database/build/build_test.go|271 col 28| unused-parameter: parameter 'v' seems to be unused, consider removing or renaming it as _ (revive)
compiler/native/parse_test.go|851 col 24| unused-parameter: parameter 'p' seems to be unused, consider removing or renaming it as _ (revive)
api/metrics.go|444| unnecessary leading newline (whitespace)
api/schedule/update.go|128 col 2| if statements should only be cuddled with assignments (wsl)
database/resource.go|30 col 20| Non-inherited new context, use function like context.WithXXX
instead (contextcheck)
database/resource.go|41 col 25| Non-inherited new context, use function like context.WithXXX
instead (contextcheck)
database/resource.go|54 col 19| Non-inherited new context, use function like context.WithXXX
instead (contextcheck)
database/schedule/create.go|3 col 1| directive //nolint:dupl // ignore similar code with update.go
is unused for linter "dupl" (nolintlint)
compiler/native/compile.go|264 col 1| directive //nolint:dupl,lll // linter thinks the steps and stages workflows are identical
is unused for linter "dupl" (nolintlint)
compiler/native/compile.go|361 col 1| directive //nolint:dupl,lll // linter thinks the steps and stages workflows are identical
is unused for linter "dupl" (nolintlint)
api/admin/step.go|3 col 1| directive //nolint:dupl // ignore similar code
is unused for linter "dupl" (nolintlint)
secret/vault/count.go|37 col 2| directive //nolint:staticcheck // ignore false positive
is unused for linter "staticcheck" (nolintlint)
secret/vault/get.go|40 col 2| directive //nolint:ineffassign,staticcheck // ignore false positive
is unused for linter "staticcheck" (nolintlint)
secret/vault/list.go|45 col 2| directive //nolint:staticcheck // ignore false positive
is unused for linter "staticcheck" (nolintlint)
Filtered Findings (0)
Annotations
Check failure on line 12 in router/middleware/scm_test.go
github-actions / golangci
[golangci] router/middleware/scm_test.go#L12
could not import github.com/go-vela/server/scm/github (-: # github.com/go-vela/server/scm/github
Raw output
router/middleware/scm_test.go:12:2: could not import github.com/go-vela/server/scm/github (-: # github.com/go-vela/server/scm/github
Check failure on line 558 in scm/github/repo.go
github-actions / golangci
[golangci] scm/github/repo.go#L558
cannot use true (untyped bool constant) as int value in argument to client.Repositories.GetBranch) (typecheck)
Raw output
scm/github/repo.go:558:86: cannot use true (untyped bool constant) as int value in argument to client.Repositories.GetBranch) (typecheck)
"github.com/go-vela/server/scm/github"
^
Check failure on line 22 in router/middleware/perm/perm_test.go
github-actions / golangci
[golangci] router/middleware/perm/perm_test.go#L22
could not import github.com/go-vela/server/scm/github (-: # github.com/go-vela/server/scm/github
Raw output
router/middleware/perm/perm_test.go:22:2: could not import github.com/go-vela/server/scm/github (-: # github.com/go-vela/server/scm/github
Check failure on line 558 in scm/github/repo.go
github-actions / golangci
[golangci] scm/github/repo.go#L558
cannot use true (untyped bool constant) as int value in argument to client.Repositories.GetBranch) (typecheck)
Raw output
scm/github/repo.go:558:86: cannot use true (untyped bool constant) as int value in argument to client.Repositories.GetBranch) (typecheck)
"github.com/go-vela/server/scm/github"
^
Check failure on line 25 in router/middleware/pipeline/pipeline_test.go
github-actions / golangci
[golangci] router/middleware/pipeline/pipeline_test.go#L25
could not import github.com/go-vela/server/scm/github (-: # github.com/go-vela/server/scm/github
Raw output
router/middleware/pipeline/pipeline_test.go:25:2: could not import github.com/go-vela/server/scm/github (-: # github.com/go-vela/server/scm/github
Check failure on line 558 in scm/github/repo.go
github-actions / golangci
[golangci] scm/github/repo.go#L558
cannot use true (untyped bool constant) as int value in argument to client.Repositories.GetBranch) (typecheck)
Raw output
scm/github/repo.go:558:86: cannot use true (untyped bool constant) as int value in argument to client.Repositories.GetBranch) (typecheck)
"github.com/go-vela/server/scm/github"
^
Check failure on line 1 in scm/github/access.go
github-actions / golangci
[golangci] scm/github/access.go#L1
: # github.com/go-vela/server/scm/github [github.com/go-vela/server/scm/github.test]
Raw output
scm/github/access.go:1: : # github.com/go-vela/server/scm/github [github.com/go-vela/server/scm/github.test]
Check failure on line 558 in scm/github/repo.go
github-actions / golangci
[golangci] scm/github/repo.go#L558
cannot use true (untyped bool constant) as int value in argument to client.Repositories.GetBranch (typecheck)
Raw output
scm/github/repo.go:558:86: cannot use true (untyped bool constant) as int value in argument to client.Repositories.GetBranch (typecheck)
// SPDX-License-Identifier: Apache-2.0
Check failure on line 95 in queue/redis/redis_test.go
github-actions / golangci
[golangci] queue/redis/redis_test.go#L95
`_steps` is unused (deadcode)
Raw output
queue/redis/redis_test.go:95:2: `_steps` is unused (deadcode)
_steps = &pipeline.Build{
^
Check failure on line 3 in database/pipeline/create.go
github-actions / golangci
[golangci] database/pipeline/create.go#L3
3-53 lines are duplicate of `database/pipeline/update.go:3-54` (dupl)
Raw output
database/pipeline/create.go:3: 3-53 lines are duplicate of `database/pipeline/update.go:3-54` (dupl)
package pipeline
import (
"context"
"github.com/go-vela/types/constants"
"github.com/go-vela/types/database"
"github.com/go-vela/types/library"
"github.com/sirupsen/logrus"
)
// 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
github-actions / golangci
[golangci] database/pipeline/update.go#L3
3-54 lines are duplicate of `database/pipeline/create.go:3-53` (dupl)
Raw output
database/pipeline/update.go:3: 3-54 lines are duplicate of `database/pipeline/create.go:3-53` (dupl)
package pipeline
import (
"context"
"github.com/go-vela/types/constants"
"github.com/go-vela/types/database"
"github.com/go-vela/types/library"
"github.com/sirupsen/logrus"
)
// 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 mock/server/schedule.go
github-actions / golangci
[golangci] mock/server/schedule.go#L3
3-211 lines are duplicate of `mock/server/secret.go:4-167` (dupl)
Raw output
mock/server/schedule.go:3: 3-211 lines are duplicate of `mock/server/secret.go:4-167` (dupl)
package server
import (
"encoding/json"
"fmt"
"net/http"
"strings"
"github.com/gin-gonic/gin"
"github.com/go-vela/types"
"github.com/go-vela/types/library"
)
const (
// ScheduleResp represents a JSON return for a single schedule.
ScheduleResp = `{
"id": 2,
"active": true,
"name": "foo",
"entry": "@weekly",
"created_at": 1683154980,
"created_by": "octocat",
"updated_at": 1683154980,
"updated_by": "octocat",
"scheduled_at": 0,
"repo": {
"id": 1,
"user_id": 1,
"org": "github",
"name": "octocat",
"full_name": "github/octocat",
"link": "https://github.com/github/octocat",
"clone": "https://github.com/github/octocat.git",
"branch": "main",
"topics": [],
"build_limit": 10,
"timeout": 30,
"counter": 0,
"visibility": "public",
"private": false,
"trusted": false,
"active": true,
"allow_pull": false,
"allow_push": true,
"allow_deploy": false,
"allow_tag": false,
"allow_comment": false,
"pipeline_type": "yaml",
"previous_name": ""
}
}`
SchedulesResp = `[
{
"id": 2,
"active": true,
"name": "foo",
"entry": "@weekly",
"created_at": 1683154980,
"created_by": "octocat",
"updated_at": 1683154980,
"updated_by": "octocat",
"scheduled_at": 0,
"repo": {
"id": 1,
"user_id": 1,
"org": "github",
"name": "octokitty",
"full_name": "github/octokitty",
"link": "https://github.com/github/octokitty",
"clone": "https://github.com/github/octokitty.git",
"branch": "main",
"topics": [],
"build_limit": 10,
"timeout": 30,
"counter": 0,
"visibility": "public",
"private": false,
"trusted": false,
"active": true,
"allow_pull": false,
"allow_push": true,
"allow_deploy": false,
"allow_tag": false,
"allow_comment": false,
"pipeline_type": "yaml",
"previous_name": ""
}
},
{
"id": 1,
"active": true,
"name": "bar",
"entry": "@weekly",
"created_at": 1683154974,
"created_by": "octocat",
"updated_at": 1683154974,
"updated_by": "octocat",
"scheduled_at": 0,
"repo": {
"id": 1,
"user_id": 1,
"org": "github",
"name": "octokitty",
"full_name": "github/octokitty",
"link": "https://github.com/github/octokitty",
"clone": "https://github.com/github/octokitty.git",
"branch": "main",
"topics": [],
"build_limit": 10,
"timeout": 30,
"counter": 0,
"visibility": "public",
"private": false,
"trusted": false,
"active": true,
"allow_pull": false,
"allow_push": true,
"allow_deploy": false,
"allow_tag": false,
"allow_comment": false,
"pipeline_type": "yaml",
"previous_name": ""
}
}
]`
)
// getSchedules returns mock JSON for a http GET.
func getSchedules(c *gin.Context) {
data := []byte(SchedulesResp)
var body []library.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 library.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 library.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 library.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 36 in secret/native/count_test.go
github-actions / golangci
[golangci] secret/native/count_test.go#L36
Error return value of `db.DeleteSecret` is not checked (errcheck)
Raw output
secret/native/count_test.go:36:18: Error return value of `db.DeleteSecret` is not checked (errcheck)
db.DeleteSecret(context.TODO(), sec)
^
Check failure on line 39 in secret/native/create_test.go
github-actions / golangci
[golangci] secret/native/create_test.go#L39
Error return value of `db.DeleteSecret` is not checked (errcheck)
Raw output
secret/native/create_test.go:39:18: Error return value of `db.DeleteSecret` is not checked (errcheck)
db.DeleteSecret(context.TODO(), want)
^
Check failure on line 86 in secret/native/create_test.go
github-actions / golangci
[golangci] secret/native/create_test.go#L86
Error return value of `db.DeleteSecret` is not checked (errcheck)
Raw output
secret/native/create_test.go:86:18: Error return value of `db.DeleteSecret` is not checked (errcheck)
db.DeleteSecret(context.TODO(), want)
^
Check failure on line 54 in internal/token/refresh_test.go
github-actions / golangci
[golangci] internal/token/refresh_test.go#L54
Error return value of `db.DeleteUser` is not checked (errcheck)
Raw output
internal/token/refresh_test.go:54:16: Error return value of `db.DeleteUser` is not checked (errcheck)
db.DeleteUser(context.TODO(), u)
^
Check failure on line 115 in internal/token/refresh_test.go
github-actions / golangci
[golangci] internal/token/refresh_test.go#L115
Error return value of `db.DeleteUser` is not checked (errcheck)
Raw output
internal/token/refresh_test.go:115:16: Error return value of `db.DeleteUser` is not checked (errcheck)
db.DeleteUser(context.TODO(), u)
^
Check failure on line 60 in router/middleware/worker/worker_test.go
github-actions / golangci
[golangci] router/middleware/worker/worker_test.go#L60
Error return value of `db.DeleteWorker` is not checked (errcheck)
Raw output
router/middleware/worker/worker_test.go:60:18: Error return value of `db.DeleteWorker` is not checked (errcheck)
db.DeleteWorker(context.TODO(), want)
^
Check failure on line 276 in router/middleware/claims/claims_test.go
github-actions / golangci
[golangci] router/middleware/claims/claims_test.go#L276
Error return value of `db.DeleteUser` is not checked (errcheck)
Raw output
router/middleware/claims/claims_test.go:276:16: Error return value of `db.DeleteUser` is not checked (errcheck)
db.DeleteUser(_context.TODO(), u)
^
Check failure on line 67 in router/middleware/org/org_test.go
github-actions / golangci
[golangci] router/middleware/org/org_test.go#L67
Error return value of `db.DeleteRepo` is not checked (errcheck)
Raw output
router/middleware/org/org_test.go:67:16: Error return value of `db.DeleteRepo` is not checked (errcheck)
db.DeleteRepo(context.TODO(), r)
^
Check failure on line 74 in router/middleware/repo/repo_test.go
github-actions / golangci
[golangci] router/middleware/repo/repo_test.go#L74
Error return value of `db.DeleteRepo` is not checked (errcheck)
Raw output
router/middleware/repo/repo_test.go:74:16: Error return value of `db.DeleteRepo` is not checked (errcheck)
db.DeleteRepo(context.TODO(), want)
^
Check failure on line 91 in router/middleware/build/build_test.go
github-actions / golangci
[golangci] router/middleware/build/build_test.go#L91
Error return value of `db.DeleteBuild` is not checked (errcheck)
Raw output
router/middleware/build/build_test.go:91:17: Error return value of `db.DeleteBuild` is not checked (errcheck)
db.DeleteBuild(context.TODO(), want)
^
Check failure on line 92 in router/middleware/build/build_test.go
github-actions / golangci
[golangci] router/middleware/build/build_test.go#L92
Error return value of `db.DeleteRepo` is not checked (errcheck)
Raw output
router/middleware/build/build_test.go:92:16: Error return value of `db.DeleteRepo` is not checked (errcheck)
db.DeleteRepo(context.TODO(), r)
^
Check failure on line 80 in router/middleware/service/service_test.go
github-actions / golangci
[golangci] router/middleware/service/service_test.go#L80
Error return value of `db.DeleteBuild` is not checked (errcheck)
Raw output
router/middleware/service/service_test.go:80:17: Error return value of `db.DeleteBuild` is not checked (errcheck)
db.DeleteBuild(context.TODO(), b)
^
Check failure on line 82 in router/middleware/service/service_test.go
github-actions / golangci
[golangci] router/middleware/service/service_test.go#L82
Error return value of `db.DeleteService` is not checked (errcheck)
Raw output
router/middleware/service/service_test.go:82:19: Error return value of `db.DeleteService` is not checked (errcheck)
db.DeleteService(context.TODO(), want)
^