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 2022/01/07 13:48:09 UTC
[camel-k] 03/24: fix: 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 5b5441456382c9b483bd3d52faee229e7b17dbb8
Author: Pasquale Congiusti <pa...@gmail.com>
AuthorDate: Fri Nov 26 12:02:49 2021 +0100
fix: lint complains
---
e2e/common/config/config_test.go | 4 ++--
pkg/cmd/run_help.go | 9 +++++----
pkg/cmd/util_content.go | 11 ++---------
pkg/trait/trait_types.go | 2 +-
pkg/util/kubernetes/factory.go | 2 +-
5 files changed, 11 insertions(+), 17 deletions(-)
diff --git a/e2e/common/config/config_test.go b/e2e/common/config/config_test.go
index e5697a1..9dcf9f3 100644
--- a/e2e/common/config/config_test.go
+++ b/e2e/common/config/config_test.go
@@ -257,8 +257,8 @@ func TestRunConfigExamples(t *testing.T) {
Expect(Kamel("run", "-n", ns, "./files/resource-file-location-route.groovy", "--resource", fmt.Sprintf("file:%s@/tmp/file.txt", tmpFile.Name())).Execute()).To(Succeed())
Eventually(IntegrationPodPhase(ns, "resource-file-location-route"), TestTimeoutMedium).Should(Equal(corev1.PodRunning))
- Eventually(IntegrationConditionStatus(ns, "resource-file-location-route", v1.IntegrationConditionReady), TestTimeoutMedium).Should(Equal(corev1.ConditionTrue))
- Eventually(IntegrationLogs(ns, "resource-file-location-route"), TestTimeoutMedium).Should(ContainSubstring("Hello from test!"))
+ Eventually(IntegrationConditionStatus(ns, "resource-file-location-route", v1.IntegrationConditionReady), TestTimeoutShort).Should(Equal(corev1.ConditionTrue))
+ Eventually(IntegrationLogs(ns, "resource-file-location-route"), TestTimeoutShort).Should(ContainSubstring("Hello from test!"))
Expect(Kamel("delete", "--all", "-n", ns).Execute()).To(Succeed())
// When the integration is deleted, then, also the autogenerated configmaps must be cleaned
diff --git a/pkg/cmd/run_help.go b/pkg/cmd/run_help.go
index 1970da0..0a27687 100644
--- a/pkg/cmd/run_help.go
+++ b/pkg/cmd/run_help.go
@@ -19,7 +19,7 @@ package cmd
import (
"context"
- "crypto/sha1"
+ "crypto/sha1" //nolint
"fmt"
"path"
"path/filepath"
@@ -264,8 +264,9 @@ func convertFileToConfigmap(ctx context.Context, c client.Client, resourceSpec v
return cm, nil
}
+//nolint
func hashFrom(contents ...[]byte) string {
- // SHA1 because we need to limit the lenght to less than 64 chars
+ // SHA1 because we need to limit the length to less than 64 chars
hash := sha1.New()
for _, c := range contents {
hash.Write(c)
@@ -274,7 +275,7 @@ func hashFrom(contents ...[]byte) string {
return fmt.Sprintf("%x", hash.Sum(nil))
}
-// ApplyConfigOption will set the proper --config option behavior to the IntegrationSpec
+// ApplyConfigOption will set the proper --config option behavior to the IntegrationSpec.
func ApplyConfigOption(ctx context.Context, config *RunConfigOption, integration *v1.Integration, c client.Client,
namespace string, enableCompression bool) (*corev1.ConfigMap, error) {
// A config option cannot specify destination path
@@ -284,7 +285,7 @@ func ApplyConfigOption(ctx context.Context, config *RunConfigOption, integration
return applyOption(ctx, config, integration, c, namespace, enableCompression, v1.ResourceTypeConfig)
}
-// ApplyResourceOption will set the proper --resource option behavior to the IntegrationSpec
+// ApplyResourceOption will set the proper --resource option behavior to the IntegrationSpec.
func ApplyResourceOption(ctx context.Context, config *RunConfigOption, integration *v1.Integration, c client.Client,
namespace string, enableCompression bool) (*corev1.ConfigMap, error) {
return applyOption(ctx, config, integration, c, namespace, enableCompression, v1.ResourceTypeData)
diff --git a/pkg/cmd/util_content.go b/pkg/cmd/util_content.go
index 8b52a34..67e706a 100644
--- a/pkg/cmd/util_content.go
+++ b/pkg/cmd/util_content.go
@@ -23,7 +23,6 @@ import (
"io"
"net/http"
"net/url"
- "os"
"regexp"
"strings"
@@ -31,18 +30,12 @@ import (
)
const (
+ // Megabyte represent the related unit.
Megabyte = 1 << 20
+ // Kilobyte represent the related unit.
Kilobyte = 1 << 10
)
-func fileSize(source string) (int64, error) {
- fi, err := os.Stat(source)
- if err != nil {
- return -1, err
- }
- return fi.Size(), nil
-}
-
func loadRawContent(ctx context.Context, source string) ([]byte, string, error) {
var content []byte
var err error
diff --git a/pkg/trait/trait_types.go b/pkg/trait/trait_types.go
index bb00d49..5173095 100644
--- a/pkg/trait/trait_types.go
+++ b/pkg/trait/trait_types.go
@@ -48,7 +48,7 @@ const (
False = "false"
)
-// Identifiable represent an identifiable type
+// Identifiable represent an identifiable type.
type Identifiable interface {
ID() ID
}
diff --git a/pkg/util/kubernetes/factory.go b/pkg/util/kubernetes/factory.go
index 6b0e892..9d32be1 100644
--- a/pkg/util/kubernetes/factory.go
+++ b/pkg/util/kubernetes/factory.go
@@ -116,7 +116,7 @@ func NewResourceRequirements(reqs []string) (corev1.ResourceRequirements, error)
return resReq, nil
}
-// NewConfigmap will create a Configmap
+// NewConfigmap will create a Configmap.
func NewConfigmap(namespace, cmName, originalFilename string, generatedKey string,
textData string, binaryData []byte) *corev1.ConfigMap {
immutable := true