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 ddb562baa57f350159a011c9973cf4da1585e3b2 Author: Pasquale Congiusti <[email protected]> AuthorDate: Wed Jan 21 08:42:25 2026 +0100 chore(ci): tune lint configuration --- .golangci.yml | 5 +++++ e2e/advanced/synthetic_test.go | 5 +++-- e2e/common/misc/pipe_test.go | 3 ++- e2e/common/traits/istio_test.go | 3 ++- e2e/support/test_support.go | 5 +++-- pkg/cmd/bind.go | 3 ++- pkg/cmd/run.go | 6 +++--- pkg/trait/cron.go | 1 - pkg/trait/knative.go | 1 - 9 files changed, 20 insertions(+), 12 deletions(-) diff --git a/.golangci.yml b/.golangci.yml index a5aa51a6e..a4e69f6ae 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -45,6 +45,11 @@ linters: - wsl - wsl_v5 settings: + goconst: + min-len: 4 + min-occurrences: 5 + ignore-calls: true + numbers: false lll: line-length: 170 mnd: diff --git a/e2e/advanced/synthetic_test.go b/e2e/advanced/synthetic_test.go index 60d3f3b05..e5ec2d086 100644 --- a/e2e/advanced/synthetic_test.go +++ b/e2e/advanced/synthetic_test.go @@ -24,6 +24,7 @@ package advanced import ( "context" + "strconv" "testing" . "github.com/onsi/gomega" @@ -63,12 +64,12 @@ func TestSyntheticIntegrationFromDeployment(t *testing.T) { // Install Camel K with the proper configuration support InstallOperatorWithConf(t, ctx, g, ns, "", false, map[string]string{ - "CAMEL_K_SYNTHETIC_INTEGRATIONS": "true", + "CAMEL_K_SYNTHETIC_INTEGRATIONS": strconv.FormatBool(true), }, ) g.Eventually(OperatorPodHas(t, ctx, ns, func(op *corev1.Pod) bool { if envVar := envvar.Get(op.Spec.Containers[0].Env, "CAMEL_K_SYNTHETIC_INTEGRATIONS"); envVar != nil { - return envVar.Value == "true" + return envVar.Value == strconv.FormatBool(true) } return false diff --git a/e2e/common/misc/pipe_test.go b/e2e/common/misc/pipe_test.go index 8a89c7a19..4aa7797bd 100644 --- a/e2e/common/misc/pipe_test.go +++ b/e2e/common/misc/pipe_test.go @@ -24,6 +24,7 @@ package common import ( "context" + "strconv" "testing" . "github.com/onsi/gomega" @@ -88,7 +89,7 @@ func TestPipe(t *testing.T) { g.Eventually(IntegrationLogs(t, ctx, ns, "no-error-binding"), TestTimeoutShort). Should(And( ContainSubstring("[integrationLogger]"), - ContainSubstring("true"), + ContainSubstring(strconv.FormatBool(true)), )) }) diff --git a/e2e/common/traits/istio_test.go b/e2e/common/traits/istio_test.go index 30ff98786..4837392cc 100644 --- a/e2e/common/traits/istio_test.go +++ b/e2e/common/traits/istio_test.go @@ -24,6 +24,7 @@ package common import ( "context" + "strconv" "testing" . "github.com/onsi/gomega" @@ -47,7 +48,7 @@ func TestIstioTrait(t *testing.T) { pod := IntegrationPod(t, ctx, ns, name)() g.Expect(pod.ObjectMeta.Annotations).NotTo(BeNil()) annotations := pod.ObjectMeta.Annotations - g.Expect(annotations["sidecar.istio.io/inject"]).To(Equal("true")) + g.Expect(annotations["sidecar.istio.io/inject"]).To(Equal(strconv.FormatBool(true))) g.Expect(annotations["traffic.sidecar.istio.io/includeOutboundIPRanges"]).To(Equal("10.0.0.0/8,172.16.0.0/12,192.168.0.0/16")) }) }) diff --git a/e2e/support/test_support.go b/e2e/support/test_support.go index 021b6b44a..77f86c854 100644 --- a/e2e/support/test_support.go +++ b/e2e/support/test_support.go @@ -38,6 +38,7 @@ import ( "regexp" "runtime/debug" "sort" + "strconv" "strings" "sync" "testing" @@ -1586,7 +1587,7 @@ func AutogeneratedConfigmapsCount(t *testing.T, ctx context.Context, ns string) if err := TestClient(t).List(ctx, &lst, ctrl.InNamespace(ns), ctrl.MatchingLabels{ - kubernetes.ConfigMapAutogenLabel: "true", + kubernetes.ConfigMapAutogenLabel: strconv.FormatBool(true), }); err != nil { failTest(t, err) } @@ -2855,7 +2856,7 @@ func deleteKnativeBroker(t *testing.T, ctx context.Context, ns metav1.Object) { func deleteTestNamespace(t *testing.T, ctx context.Context, ns ctrl.Object) { value, saveNS := os.LookupEnv("CAMEL_K_TEST_SAVE_FAILED_TEST_NAMESPACE") - if t != nil && t.Failed() && saveNS && value == "true" { + if t != nil && t.Failed() && saveNS && value == strconv.FormatBool(true) { t.Logf("Warning: retaining failed test project %q", ns.GetName()) return } diff --git a/pkg/cmd/bind.go b/pkg/cmd/bind.go index 174434449..e5b991196 100644 --- a/pkg/cmd/bind.go +++ b/pkg/cmd/bind.go @@ -22,6 +22,7 @@ import ( "errors" "fmt" "maps" + "strconv" "strings" v1 "github.com/apache/camel-k/v2/pkg/apis/camel/v1" @@ -95,7 +96,7 @@ type bindCmdOptions struct { func (o *bindCmdOptions) preRunE(cmd *cobra.Command, args []string) error { if o.OutputFormat != "" { // let the command work in offline mode - cmd.Annotations[offlineCommandLabel] = "true" + cmd.Annotations[offlineCommandLabel] = strconv.FormatBool(true) } return o.preRun(cmd, args) diff --git a/pkg/cmd/run.go b/pkg/cmd/run.go index 662ca4a82..e6d8e9595 100644 --- a/pkg/cmd/run.go +++ b/pkg/cmd/run.go @@ -27,6 +27,7 @@ import ( "os/signal" "path" "reflect" + "strconv" "strings" "syscall" @@ -191,10 +192,9 @@ func (o *runCmdOptions) decode(cmd *cobra.Command, args []string) error { return err } - //nolint:goconst if o.OutputFormat != "" { // let the command work in offline mode - cmd.Annotations[offlineCommandLabel] = "true" + cmd.Annotations[offlineCommandLabel] = strconv.FormatBool(true) } // backup the values from values belonging to kamel.run by coping the @@ -737,7 +737,7 @@ func (o *runCmdOptions) applyAnnotations(it *v1.Integration) { } } if o.DontRunAfterBuild { - it.Annotations[v1.IntegrationDontRunAfterBuildAnnotation] = "true" + it.Annotations[v1.IntegrationDontRunAfterBuildAnnotation] = strconv.FormatBool(true) } } diff --git a/pkg/trait/cron.go b/pkg/trait/cron.go index 87088b050..7c87348c2 100644 --- a/pkg/trait/cron.go +++ b/pkg/trait/cron.go @@ -232,7 +232,6 @@ func (t *cronTrait) Apply(e *Environment) error { v1.IntegrationConditionCronJobAvailableReason, conditionMessage, ) - } return nil diff --git a/pkg/trait/knative.go b/pkg/trait/knative.go index 12bc9f694..753803814 100644 --- a/pkg/trait/knative.go +++ b/pkg/trait/knative.go @@ -326,7 +326,6 @@ func (t *knativeTrait) configureEvents(e *Environment, env *knativeapi.CamelEnvi eventType := knativeutil.ExtractEventType(serviceURI) serviceName := eventType if serviceName == "" { - //nolint:goconst serviceName = "default" } servicePath := "/events/" + eventType
