You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by pc...@apache.org on 2023/10/04 10:53:02 UTC

[camel-k] 04/09: fix(ci): lint complains

This is an automated email from the ASF dual-hosted git repository.

pcongiusti pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel-k.git

commit 9ebf9f6b75a5e67d6659c1f1811f90511377f9fa
Author: Pasquale Congiusti <pa...@gmail.com>
AuthorDate: Tue Sep 26 09:39:11 2023 +0200

    fix(ci): lint complains
---
 pkg/builder/image.go |  2 +-
 pkg/builder/tasks.go |  6 +++---
 pkg/trait/builder.go | 10 +++++-----
 3 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/pkg/builder/image.go b/pkg/builder/image.go
index c6bc6d9b8..1ea9a4983 100644
--- a/pkg/builder/image.go
+++ b/pkg/builder/image.go
@@ -50,7 +50,7 @@ type imageSteps struct {
 	JvmDockerfile           Step
 }
 
-// Image used to export the steps available on an Image building process
+// Image used to export the steps available on an Image building process.
 var Image = imageSteps{
 	IncrementalImageContext: NewStep(ApplicationPackagePhase, incrementalImageContext),
 	NativeImageContext:      NewStep(ApplicationPackagePhase, nativeImageContext),
diff --git a/pkg/builder/tasks.go b/pkg/builder/tasks.go
index 3b35e2db2..c61a8df2f 100644
--- a/pkg/builder/tasks.go
+++ b/pkg/builder/tasks.go
@@ -24,7 +24,7 @@ import (
 	v1 "github.com/apache/camel-k/v2/pkg/apis/camel/v1"
 )
 
-// Build convert the Build CR in a struct that can be executable as an operator routing
+// Build convert the Build CR in a struct that can be executable as an operator routine.
 func (b *Builder) Build(build *v1.Build) *Build {
 	return &Build{
 		builder: *b,
@@ -32,7 +32,7 @@ func (b *Builder) Build(build *v1.Build) *Build {
 	}
 }
 
-// Task convert the task in a routine task which can be executed inside operator
+// Task convert the task in a routine task which can be executed inside operator.
 func (b *Build) Task(task v1.Task) Task {
 	switch {
 	case task.Builder != nil:
@@ -129,7 +129,7 @@ func (t *unsupportedTask) Do(_ context.Context) v1.BuildStatus {
 
 var _ Task = &missingTask{}
 
-// TaskByName return the task identified by the name parameter
+// TaskByName return the task identified by the name parameter.
 func (b *Build) TaskByName(name string) Task {
 	for _, task := range b.build.Spec.Tasks {
 		switch {
diff --git a/pkg/trait/builder.go b/pkg/trait/builder.go
index c8a514208..e59ee7da5 100644
--- a/pkg/trait/builder.go
+++ b/pkg/trait/builder.go
@@ -377,15 +377,15 @@ func getImageName(e *Environment) string {
 }
 
 func (t *builderTrait) customTasks() ([]v1.Task, error) {
-	customTasks := make([]v1.Task, len(t.Tasks), len(t.Tasks))
+	customTasks := make([]v1.Task, len(t.Tasks))
 	for i, t := range t.Tasks {
 		splitted := strings.Split(t, ";")
 		if len(splitted) < 3 {
-			return nil, fmt.Errorf(`You need to provide a custom task with at least 3 arguments, ie "my-task-name;my-image;echo 'hello', was %v"`, t)
+			return nil, fmt.Errorf(`provide a custom task with at least 3 arguments, ie "my-task-name;my-image;echo 'hello', was %v"`, t)
 		}
 		var containerCommand string
 		if len(splitted) > 3 {
-			//recompose in case of usage of separator char in the script
+			// recompose in case of usage of separator char in the script
 			containerCommand = strings.Join(splitted[2:], ";")
 		} else {
 			containerCommand = splitted[2]
@@ -405,12 +405,12 @@ func (t *builderTrait) customTasks() ([]v1.Task, error) {
 }
 
 // we may get a command in the following format `/bin/bash -c "ls && echo 'hello'`
-// which should provide a string with {"/bin/bash", "-c", "ls && echo 'hello'"}
+// which should provide a string with {"/bin/bash", "-c", "ls && echo 'hello'"}.
 func splitContainerCommand(command string) []string {
 	matches := commandsRegexp.FindAllString(command, -1)
 	removeQuotes := make([]string, 0, len(matches))
 	for _, m := range matches {
-		removeQuotes = append(removeQuotes, strings.Replace(m, "\"", "", -1))
+		removeQuotes = append(removeQuotes, strings.ReplaceAll(m, "\"", ""))
 	}
 
 	return removeQuotes