Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: remove types dependency #610

Merged
merged 1 commit into from
Oct 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions api/build.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import (

"github.com/gin-gonic/gin"

"github.com/go-vela/types"
api "github.com/go-vela/server/api/types"
"github.com/go-vela/worker/router/middleware/executor"
)

Expand Down Expand Up @@ -47,7 +47,7 @@ func GetBuild(c *gin.Context) {
if err != nil {
msg := fmt.Errorf("unable to read build: %w", err).Error()

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

return
}
Expand Down Expand Up @@ -90,7 +90,7 @@ func CancelBuild(c *gin.Context) {
if err != nil {
msg := fmt.Errorf("unable to cancel build: %w", err).Error()

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

return
}
Expand Down
13 changes: 6 additions & 7 deletions api/executor.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import (
"github.com/gin-gonic/gin"

api "github.com/go-vela/server/api/types"
"github.com/go-vela/types"
"github.com/go-vela/worker/executor"
exec "github.com/go-vela/worker/router/middleware/executor"
)
Expand Down Expand Up @@ -57,7 +56,7 @@ func GetExecutor(c *gin.Context) {
if err != nil {
msg := fmt.Errorf("unable to retrieve build: %w", err).Error()

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

return
}
Expand All @@ -67,7 +66,7 @@ func GetExecutor(c *gin.Context) {
if err != nil {
msg := fmt.Errorf("unable to retrieve pipeline: %w", err).Error()

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

return
}
Expand Down Expand Up @@ -104,7 +103,7 @@ func GetExecutors(c *gin.Context) {
if value == nil {
msg := "no running executors found"

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

return
}
Expand All @@ -114,7 +113,7 @@ func GetExecutors(c *gin.Context) {
if !ok {
msg := "unable to get executors"

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

return
}
Expand All @@ -136,7 +135,7 @@ func GetExecutors(c *gin.Context) {
if err != nil {
msg := fmt.Errorf("unable to retrieve build: %w", err).Error()

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

return
}
Expand All @@ -146,7 +145,7 @@ func GetExecutors(c *gin.Context) {
if err != nil {
msg := fmt.Errorf("unable to retrieve pipeline: %w", err).Error()

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

return
}
Expand Down
4 changes: 2 additions & 2 deletions api/pipeline.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import (

"github.com/gin-gonic/gin"

"github.com/go-vela/types"
api "github.com/go-vela/server/api/types"
"github.com/go-vela/worker/router/middleware/executor"
)

Expand Down Expand Up @@ -46,7 +46,7 @@ func GetPipeline(c *gin.Context) {
if err != nil {
msg := fmt.Errorf("unable to read pipeline: %w", err).Error()

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

return
}
Expand Down
4 changes: 2 additions & 2 deletions api/repo.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import (

"github.com/gin-gonic/gin"

"github.com/go-vela/types"
api "github.com/go-vela/server/api/types"
"github.com/go-vela/worker/router/middleware/executor"
)

Expand Down Expand Up @@ -46,7 +46,7 @@ func GetRepo(c *gin.Context) {
if err != nil {
msg := fmt.Errorf("unable to read build: %w", err).Error()

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

return
}
Expand Down
8 changes: 3 additions & 5 deletions cmd/vela-worker/exec.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,8 @@
"github.com/go-vela/sdk-go/vela"
api "github.com/go-vela/server/api/types"
"github.com/go-vela/server/compiler/types/pipeline"
"github.com/go-vela/server/constants"
"github.com/go-vela/server/queue/models"
"github.com/go-vela/types"
"github.com/go-vela/types/constants"
"github.com/go-vela/types/library"
"github.com/go-vela/worker/executor"
"github.com/go-vela/worker/runtime"
"github.com/go-vela/worker/version"
Expand All @@ -27,8 +25,8 @@
// exec is a helper function to poll the queue
// and execute Vela pipelines for the Worker.
//
//nolint:nilerr,funlen // ignore returning nil - don't want to crash worker

Check failure on line 28 in cmd/vela-worker/exec.go

View workflow job for this annotation

GitHub Actions / golangci

[golangci] cmd/vela-worker/exec.go#L28

directive `//nolint:nilerr,funlen // ignore returning nil - don't want to crash worker` is unused for linter "nilerr" (nolintlint)
Raw output
cmd/vela-worker/exec.go:28:1: directive `//nolint:nilerr,funlen // ignore returning nil - don't want to crash worker` is unused for linter "nilerr" (nolintlint)
//nolint:nilerr,funlen // ignore returning nil - don't want to crash worker
^
func (w *Worker) exec(index int, config *api.Worker) error {

Check failure on line 29 in cmd/vela-worker/exec.go

View workflow job for this annotation

GitHub Actions / diff-review

cyclomatic complexity 31 of func `(*Worker).exec` is high (> 30) (gocyclo)

Check failure on line 29 in cmd/vela-worker/exec.go

View workflow job for this annotation

GitHub Actions / full-review

cyclomatic complexity 31 of func `(*Worker).exec` is high (> 30) (gocyclo)

Check failure on line 29 in cmd/vela-worker/exec.go

View workflow job for this annotation

GitHub Actions / golangci

[golangci] cmd/vela-worker/exec.go#L29

cyclomatic complexity 31 of func `(*Worker).exec` is high (> 30) (gocyclo)
Raw output
cmd/vela-worker/exec.go:29:1: cyclomatic complexity 31 of func `(*Worker).exec` is high (> 30) (gocyclo)
func (w *Worker) exec(index int, config *api.Worker) error {
^
var err error

// setup the version
Expand All @@ -36,7 +34,7 @@

var (
execBuildClient *vela.Client
execBuildExecutable *library.BuildExecutable
execBuildExecutable *api.BuildExecutable
p *pipeline.Build
item *models.Item
retries = 3
Expand Down Expand Up @@ -188,7 +186,7 @@
// If the ItemVersion is older or newer than what we expect, then it might
// not be safe to process the build. Fail the build and loop to the next item.
// TODO: Ask the server to re-compile and requeue the build instead of failing it.
logrus.Errorf("Failing stale queued build due to wrong item version: want %d, got %d", types.ItemVersion, item.ItemVersion)
logrus.Errorf("Failing stale queued build due to wrong item version: want %d, got %d", models.ItemVersion, item.ItemVersion)

build := item.Build
build.SetError("Unable to process stale build (queued before Vela upgrade/downgrade).")
Expand Down
2 changes: 1 addition & 1 deletion cmd/vela-worker/operate.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ import (
"golang.org/x/sync/errgroup"

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

// operate is a helper function to initiate all
Expand Down
5 changes: 2 additions & 3 deletions cmd/vela-worker/register.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,7 @@ import (
"github.com/sirupsen/logrus"

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

// checkIn is a helper function to phone home to the server.
Expand All @@ -21,7 +20,7 @@ func (w *Worker) checkIn(config *api.Worker) (bool, string, error) {
logrus.Infof("retrieving worker %s from the server", config.GetHostname())

var (
tkn *library.Token
tkn *api.Token
retries = 3
)

Expand Down
2 changes: 1 addition & 1 deletion cmd/vela-worker/run.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ import (

api "github.com/go-vela/server/api/types"
"github.com/go-vela/server/compiler/types/pipeline"
"github.com/go-vela/server/constants"
"github.com/go-vela/server/queue"
"github.com/go-vela/types/constants"
"github.com/go-vela/worker/executor"
"github.com/go-vela/worker/runtime"
)
Expand Down
2 changes: 1 addition & 1 deletion executor/executor.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (

"github.com/sirupsen/logrus"

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

// New creates and returns a Vela engine capable of
Expand Down
2 changes: 1 addition & 1 deletion executor/executor_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ import (
api "github.com/go-vela/server/api/types"
"github.com/go-vela/server/api/types/actions"
"github.com/go-vela/server/compiler/types/pipeline"
"github.com/go-vela/server/constants"
"github.com/go-vela/server/mock/server"
"github.com/go-vela/types/constants"
"github.com/go-vela/worker/executor/linux"
"github.com/go-vela/worker/executor/local"
"github.com/go-vela/worker/runtime/docker"
Expand Down
2 changes: 1 addition & 1 deletion executor/flags.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (

"github.com/urfave/cli/v2"

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

// Flags represents all supported command line
Expand Down
2 changes: 1 addition & 1 deletion executor/linux/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import (

api "github.com/go-vela/server/api/types"
"github.com/go-vela/server/compiler/types/pipeline"
"github.com/go-vela/types/constants"
"github.com/go-vela/server/constants"
"github.com/go-vela/worker/internal/service"
"github.com/go-vela/worker/internal/step"
)
Expand Down
2 changes: 1 addition & 1 deletion executor/linux/api_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (
"reflect"
"testing"

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

func TestLinux_GetBuild(t *testing.T) {
Expand Down
35 changes: 2 additions & 33 deletions executor/linux/build.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,7 @@ import (

api "github.com/go-vela/server/api/types"
"github.com/go-vela/server/compiler/types/pipeline"
"github.com/go-vela/types/constants"
"github.com/go-vela/types/library"
"github.com/go-vela/server/constants"
"github.com/go-vela/worker/internal/build"
context2 "github.com/go-vela/worker/internal/context"
"github.com/go-vela/worker/internal/image"
Expand Down Expand Up @@ -121,8 +120,6 @@ func (c *client) PlanBuild(ctx context.Context) error {
}

// update the init log with progress
//
// https://pkg.go.dev/github.com/go-vela/types/library#Log.AppendData
_log.AppendData([]byte("> Inspecting runtime network...\n"))

// inspect the runtime network for the pipeline
Expand All @@ -133,8 +130,6 @@ func (c *client) PlanBuild(ctx context.Context) error {
}

// update the init log with network information
//
// https://pkg.go.dev/github.com/go-vela/types/library#Log.AppendData
_log.AppendData(network)

c.Logger.Info("creating volume")
Expand All @@ -145,8 +140,6 @@ func (c *client) PlanBuild(ctx context.Context) error {
}

// update the init log with progress
//
// https://pkg.go.dev/github.com/go-vela/types/library#Log.AppendData
_log.AppendData([]byte("> Inspecting runtime volume...\n"))

// inspect the runtime volume for the pipeline
Expand All @@ -157,13 +150,9 @@ func (c *client) PlanBuild(ctx context.Context) error {
}

// update the init log with volume information
//
// https://pkg.go.dev/github.com/go-vela/types/library#Log.AppendData
_log.AppendData(volume)

// update the init log with progress
//
// https://pkg.go.dev/github.com/go-vela/types/library#Log.AppendData
_log.AppendData([]byte("> Preparing secrets...\n"))

// iterate through each secret provided in the pipeline
Expand Down Expand Up @@ -262,8 +251,6 @@ func (c *client) AssembleBuild(ctx context.Context) error {
}()

// update the init log with progress
//
// https://pkg.go.dev/github.com/go-vela/types/library#Log.AppendData
_log.AppendData([]byte("> Preparing service images...\n"))

// create the services for the pipeline
Expand Down Expand Up @@ -291,14 +278,10 @@ func (c *client) AssembleBuild(ctx context.Context) error {
}

// update the init log with service image info
//
// https://pkg.go.dev/github.com/go-vela/types/library#Log.AppendData
_log.AppendData(image)
}

// update the init log with progress
//
// https://pkg.go.dev/github.com/go-vela/types/library#Log.AppendData
_log.AppendData([]byte("> Preparing stage images...\n"))

// create the stages for the pipeline
Expand All @@ -319,8 +302,6 @@ func (c *client) AssembleBuild(ctx context.Context) error {
}

// update the init log with progress
//
// https://pkg.go.dev/github.com/go-vela/types/library#Log.AppendData
_log.AppendData([]byte("> Preparing step images...\n"))

// create the steps for the pipeline
Expand Down Expand Up @@ -349,14 +330,10 @@ func (c *client) AssembleBuild(ctx context.Context) error {
}

// update the init log with step image info
//
// https://pkg.go.dev/github.com/go-vela/types/library#Log.AppendData
_log.AppendData(image)
}

// update the init log with progress
//
// https://pkg.go.dev/github.com/go-vela/types/library#Log.AppendData
_log.AppendData([]byte("> Preparing secret images...\n"))

// create the secrets for the pipeline
Expand Down Expand Up @@ -394,8 +371,6 @@ func (c *client) AssembleBuild(ctx context.Context) error {
}

// update the init log with secret image info
//
// https://pkg.go.dev/github.com/go-vela/types/library#Log.AppendData
_log.AppendData(image)
}

Expand All @@ -415,8 +390,6 @@ func (c *client) AssembleBuild(ctx context.Context) error {
if len(buildOutput) > 0 {
// update the init log with progress
// (an empty value allows the runtime to opt out of providing this)
//
// https://pkg.go.dev/github.com/go-vela/types/library#Log.AppendData
_log.AppendData(buildOutput)
}

Expand All @@ -427,8 +400,6 @@ func (c *client) AssembleBuild(ctx context.Context) error {
}

// update the init log with progress
//
// https://pkg.go.dev/github.com/go-vela/types/library#Log.AppendData
_log.AppendData([]byte("> Executing secret images...\n"))

return c.err
Expand Down Expand Up @@ -698,7 +669,7 @@ func (c *client) StreamBuild(ctx context.Context) error {
//
//nolint:funlen // explanation takes up a lot of lines
func loadLazySecrets(c *client, _step *pipeline.Container) error {
_log := new(library.Log)
_log := new(api.Log)

lazySecrets := make(map[string]*api.Secret)
lazyNoSubSecrets := make(map[string]*api.Secret)
Expand Down Expand Up @@ -836,8 +807,6 @@ func loadLazySecrets(c *client, _step *pipeline.Container) error {

c.Logger.Debug("substituting container configuration after lazy loaded secret injection")
// substitute container configuration
//
// https://pkg.go.dev/github.com/go-vela/types/pipeline#Container.Substitute
err = tmpStep.Substitute()
if err != nil {
return err
Expand Down
2 changes: 1 addition & 1 deletion executor/linux/build_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@
api "github.com/go-vela/server/api/types"
"github.com/go-vela/server/compiler/native"
"github.com/go-vela/server/compiler/types/pipeline"
"github.com/go-vela/server/constants"
"github.com/go-vela/server/mock/server"
"github.com/go-vela/types/constants"
"github.com/go-vela/worker/internal/message"
"github.com/go-vela/worker/runtime"
"github.com/go-vela/worker/runtime/docker"
Expand Down Expand Up @@ -162,7 +162,7 @@
case constants.DriverKubernetes:
_pod := testPodFor(_pipeline)
_runtime, err = kubernetes.NewMock(_pod)
if err != nil {

Check failure on line 165 in executor/linux/build_test.go

View workflow job for this annotation

GitHub Actions / golangci

[golangci] executor/linux/build_test.go#L165

only one cuddle assignment allowed before if statement (wsl)
Raw output
executor/linux/build_test.go:165:5: only one cuddle assignment allowed before if statement (wsl)
				if err != nil {
				^
t.Errorf("unable to create kubernetes runtime engine: %v", err)
}
case constants.DriverDocker:
Expand Down Expand Up @@ -199,12 +199,12 @@
}

loggedError := false
for _, logEntry := range loggerHook.AllEntries() {

Check failure on line 202 in executor/linux/build_test.go

View workflow job for this annotation

GitHub Actions / golangci

[golangci] executor/linux/build_test.go#L202

ranges should only be cuddled with assignments used in the iteration (wsl)
Raw output
executor/linux/build_test.go:202:4: ranges should only be cuddled with assignments used in the iteration (wsl)
			for _, logEntry := range loggerHook.AllEntries() {
			^
// Many errors during StreamBuild get logged and ignored.
// So, Make sure there are no errors logged during StreamBuild.
if logEntry.Level == logrus.ErrorLevel {
loggedError = true
if !test.logError {

Check failure on line 207 in executor/linux/build_test.go

View workflow job for this annotation

GitHub Actions / golangci

[golangci] executor/linux/build_test.go#L207

if statements should only be cuddled with assignments used in the if statement itself (wsl)
Raw output
executor/linux/build_test.go:207:6: if statements should only be cuddled with assignments used in the if statement itself (wsl)
					if !test.logError {
					^
t.Errorf("%s StreamBuild for %s logged an Error: %v", test.name, test.pipeline, logEntry.Message)
}
}
Expand Down Expand Up @@ -319,7 +319,7 @@
for _, test := range tests {
t.Run(test.name, func(t *testing.T) {
logger := testLogger.WithFields(logrus.Fields{"test": test.name})
defer loggerHook.Reset()

Check failure on line 322 in executor/linux/build_test.go

View workflow job for this annotation

GitHub Actions / golangci

[golangci] executor/linux/build_test.go#L322

defer statements should only be cuddled with expressions on same variable (wsl)
Raw output
executor/linux/build_test.go:322:4: defer statements should only be cuddled with expressions on same variable (wsl)
			defer loggerHook.Reset()
			^

_pipeline, _, err := compiler.
Duplicate().
Expand Down Expand Up @@ -386,7 +386,7 @@
// So, Make sure there are no errors logged during StreamBuild.
if logEntry.Level == logrus.ErrorLevel {
loggedError = true
if !test.logError {

Check failure on line 389 in executor/linux/build_test.go

View workflow job for this annotation

GitHub Actions / golangci

[golangci] executor/linux/build_test.go#L389

if statements should only be cuddled with assignments used in the if statement itself (wsl)
Raw output
executor/linux/build_test.go:389:6: if statements should only be cuddled with assignments used in the if statement itself (wsl)
					if !test.logError {
					^
t.Errorf("%s StreamBuild for %s logged an Error: %v", test.name, test.pipeline, logEntry.Message)
}
}
Expand Down Expand Up @@ -602,7 +602,7 @@
for _, test := range tests {
t.Run(test.name, func(t *testing.T) {
logger := testLogger.WithFields(logrus.Fields{"test": test.name})
defer loggerHook.Reset()

Check failure on line 605 in executor/linux/build_test.go

View workflow job for this annotation

GitHub Actions / golangci

[golangci] executor/linux/build_test.go#L605

defer statements should only be cuddled with expressions on same variable (wsl)
Raw output
executor/linux/build_test.go:605:4: defer statements should only be cuddled with expressions on same variable (wsl)
			defer loggerHook.Reset()
			^

_pipeline, _, err := compiler.
Duplicate().
Expand Down Expand Up @@ -694,7 +694,7 @@
// So, Make sure there are no errors logged during StreamBuild.
if logEntry.Level == logrus.ErrorLevel {
loggedError = true
if !test.logError {

Check failure on line 697 in executor/linux/build_test.go

View workflow job for this annotation

GitHub Actions / golangci

[golangci] executor/linux/build_test.go#L697

if statements should only be cuddled with assignments used in the if statement itself (wsl)
Raw output
executor/linux/build_test.go:697:6: if statements should only be cuddled with assignments used in the if statement itself (wsl)
					if !test.logError {
					^
t.Errorf("%s StreamBuild for %s logged an Error: %v", test.name, test.pipeline, logEntry.Message)
}
}
Expand Down Expand Up @@ -942,7 +942,7 @@

percents := []int{0, 0, 50, 100}
lastIndex := len(percents) - 1
for index, stepsCompletedPercent := range percents {

Check failure on line 945 in executor/linux/build_test.go

View workflow job for this annotation

GitHub Actions / golangci

[golangci] executor/linux/build_test.go#L945

only one cuddle assignment allowed before range statement (wsl)
Raw output
executor/linux/build_test.go:945:6: only one cuddle assignment allowed before range statement (wsl)
					for index, stepsCompletedPercent := range percents {
					^
if index == 0 || index == lastIndex {
stepsRunningCount = 0
} else {
Expand Down Expand Up @@ -979,7 +979,7 @@
}

loggedError := false
for _, logEntry := range loggerHook.AllEntries() {

Check failure on line 982 in executor/linux/build_test.go

View workflow job for this annotation

GitHub Actions / golangci

[golangci] executor/linux/build_test.go#L982

ranges should only be cuddled with assignments used in the iteration (wsl)
Raw output
executor/linux/build_test.go:982:4: ranges should only be cuddled with assignments used in the iteration (wsl)
			for _, logEntry := range loggerHook.AllEntries() {
			^
// Many errors during StreamBuild get logged and ignored.
// So, Make sure there are no errors logged during StreamBuild.
if logEntry.Level == logrus.ErrorLevel {
Expand Down Expand Up @@ -1097,7 +1097,7 @@
streamFunc: func(c *client) message.StreamFunc {
return c.StreamService
},
planFunc: func(c *client) planFuncType {

Check failure on line 1100 in executor/linux/build_test.go

View workflow job for this annotation

GitHub Actions / golangci

[golangci] executor/linux/build_test.go#L1100

unused-parameter: parameter 'c' seems to be unused, consider removing or renaming it as _ (revive)
Raw output
executor/linux/build_test.go:1100:19: unused-parameter: parameter 'c' seems to be unused, consider removing or renaming it as _ (revive)
			planFunc: func(c *client) planFuncType {
			               ^
// simulate failure to call PlanService
return planNothing
},
Expand Down Expand Up @@ -1480,7 +1480,7 @@
streamRequests := make(chan message.StreamRequest)

logger := testLogger.WithFields(logrus.Fields{"test": test.name})
defer loggerHook.Reset()

Check failure on line 1483 in executor/linux/build_test.go

View workflow job for this annotation

GitHub Actions / golangci

[golangci] executor/linux/build_test.go#L1483

defer statements should only be cuddled with expressions on same variable (wsl)
Raw output
executor/linux/build_test.go:1483:4: defer statements should only be cuddled with expressions on same variable (wsl)
			defer loggerHook.Reset()
			^

_pipeline, _, err := compiler.
Duplicate().
Expand Down Expand Up @@ -1546,7 +1546,7 @@
// imitate build getting canceled or otherwise finishing before ExecBuild gets called.
done()
}
if test.earlyExecExit {

Check failure on line 1549 in executor/linux/build_test.go

View workflow job for this annotation

GitHub Actions / golangci

[golangci] executor/linux/build_test.go#L1549

if statements should only be cuddled with assignments (wsl)
Raw output
executor/linux/build_test.go:1549:5: if statements should only be cuddled with assignments (wsl)
				if test.earlyExecExit {
				^
// imitate a failure after ExecBuild starts and before it sends a StreamRequest.
close(streamRequests)
}
Expand Down Expand Up @@ -1602,7 +1602,7 @@
}
}
}
if test.logError && !loggedError {

Check failure on line 1605 in executor/linux/build_test.go

View workflow job for this annotation

GitHub Actions / golangci

[golangci] executor/linux/build_test.go#L1605

if statements should only be cuddled with assignments (wsl)
Raw output
executor/linux/build_test.go:1605:4: if statements should only be cuddled with assignments (wsl)
			if test.logError && !loggedError {
			^
t.Errorf("%s StreamBuild for %s did not log an Error but should have", test.name, test.pipeline)
}
})
Expand Down Expand Up @@ -1825,7 +1825,7 @@
}

loggedError := false
for _, logEntry := range loggerHook.AllEntries() {

Check failure on line 1828 in executor/linux/build_test.go

View workflow job for this annotation

GitHub Actions / golangci

[golangci] executor/linux/build_test.go#L1828

ranges should only be cuddled with assignments used in the iteration (wsl)
Raw output
executor/linux/build_test.go:1828:4: ranges should only be cuddled with assignments used in the iteration (wsl)
			for _, logEntry := range loggerHook.AllEntries() {
			^
// Many errors during StreamBuild get logged and ignored.
// So, Make sure there are no errors logged during StreamBuild.
if logEntry.Level == logrus.ErrorLevel {
Expand Down
Loading
Loading