diff --git a/.github/workflows/validate.yml b/.github/workflows/validate.yml index a54e396701..91955e7d28 100644 --- a/.github/workflows/validate.yml +++ b/.github/workflows/validate.yml @@ -55,5 +55,5 @@ jobs: env: GOGC: 20 with: - version: v1.55.2 - args: --verbose --deadline 15m --config .golangci.yml + version: v1.58.0 + args: --verbose --timeout 15m --config .golangci.yml diff --git a/.golangci.yml b/.golangci.yml index ac4df3b6c9..eac71d8544 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -20,7 +20,8 @@ linters-settings: line-length: 170 run: tests: false - skip-files: +issues: + exclude-files: - test_support.go linters: enable-all: true @@ -41,7 +42,7 @@ linters: - goconst - gocyclo - godox - - goerr113 + - err113 - gofumpt - golint - gomnd @@ -73,3 +74,7 @@ linters: - whitespace - wrapcheck - wsl + - execinquery + # TODO: too much work at this stage, but they should be re-enabled + - mnd + - perfsprint diff --git a/addons/master/master.go b/addons/master/master.go index deec026f18..92fec2f16d 100644 --- a/addons/master/master.go +++ b/addons/master/master.go @@ -127,7 +127,7 @@ func (t *masterTrait) Configure(e *trait.Environment) (bool, *trait.TraitConditi } if t.ResourceName == nil { - val := fmt.Sprintf("%s-lock", e.Integration.Name) + val := e.Integration.Name + "-lock" t.ResourceName = &val } @@ -190,22 +190,22 @@ func (t *masterTrait) setCustomizerConfiguration(e *trait.Environment) { if t.ResourceName != nil { resourceName := t.ResourceName e.Integration.Status.Configuration = append(e.Integration.Status.Configuration, - v1.ConfigurationSpec{Type: "property", Value: fmt.Sprintf("customizer.master.kubernetesResourceName=%s", *resourceName)}, + v1.ConfigurationSpec{Type: "property", Value: "customizer.master.kubernetesResourceNames=" + *resourceName}, ) } if t.ResourceType != nil { e.Integration.Status.Configuration = append(e.Integration.Status.Configuration, - v1.ConfigurationSpec{Type: "property", Value: fmt.Sprintf("customizer.master.leaseResourceType=%s", *t.ResourceType)}, + v1.ConfigurationSpec{Type: "property", Value: "customizer.master.leaseResourceType" + *t.ResourceType}, ) } if t.LabelKey != nil { e.Integration.Status.Configuration = append(e.Integration.Status.Configuration, - v1.ConfigurationSpec{Type: "property", Value: fmt.Sprintf("customizer.master.labelKey=%s", *t.LabelKey)}, + v1.ConfigurationSpec{Type: "property", Value: "customizer.master.labelKey=" + *t.LabelKey}, ) } if t.LabelValue != nil { e.Integration.Status.Configuration = append(e.Integration.Status.Configuration, - v1.ConfigurationSpec{Type: "property", Value: fmt.Sprintf("customizer.master.labelValue=%s", *t.LabelValue)}, + v1.ConfigurationSpec{Type: "property", Value: "customizer.master.labelValue=" + *t.LabelValue}, ) } } diff --git a/pkg/apis/camel/v1/maven_types_support.go b/pkg/apis/camel/v1/maven_types_support.go index 8f27571ed0..a0cd890831 100644 --- a/pkg/apis/camel/v1/maven_types_support.go +++ b/pkg/apis/camel/v1/maven_types_support.go @@ -40,7 +40,7 @@ func (in *MavenArtifact) GetDependencyID() string { return mvn } -// nolint: musttag // the name of the xml is dynamic +//nolint:musttag // the name of the xml is dynamic type propertiesEntry struct { XMLName xml.Name Value string `xml:",chardata"` @@ -67,6 +67,7 @@ func (m Properties) MarshalXML(e *xml.Encoder, start xml.StartElement) error { } for k, v := range m { + //nolint:musttag if err := e.Encode(propertiesEntry{XMLName: xml.Name{Local: k}, Value: v}); err != nil { return err } @@ -100,6 +101,7 @@ func (m PluginProperties) MarshalXML(e *xml.Encoder, start xml.StartElement) err for k, v := range m { if v.Value != "" { + //nolint:musttag if err := e.Encode(propertiesEntry{XMLName: xml.Name{Local: k}, Value: v.Value}); err != nil { return err } @@ -112,6 +114,7 @@ func (m PluginProperties) MarshalXML(e *xml.Encoder, start xml.StartElement) err } for key, value := range v.Properties { + //nolint:musttag if err := e.Encode(propertiesEntry{XMLName: xml.Name{Local: key}, Value: value}); err != nil { return err } diff --git a/pkg/cmd/run.go b/pkg/cmd/run.go index 54117ccc6f..0fa8eb04ad 100644 --- a/pkg/cmd/run.go +++ b/pkg/cmd/run.go @@ -1273,10 +1273,12 @@ func extractGavFromPom(path string, gav maven.Dependency) maven.Dependency { func (o *runCmdOptions) uploadChecksumFiles(path string, options spectrum.Options, platform *v1.IntegrationPlatform, artifactHTTPPath string, dependency maven.Dependency) error { return util.WithTempDir("camel-k", func(tmpDir string) error { // #nosec G401 + // nolint:gosec if err := o.uploadChecksumFile(md5.New(), tmpDir, "_md5", path, options, platform, artifactHTTPPath, dependency); err != nil { return err } // #nosec G401 + // nolint:gosec return o.uploadChecksumFile(sha1.New(), tmpDir, "_sha1", path, options, platform, artifactHTTPPath, dependency) }) } diff --git a/script/Makefile b/script/Makefile index c5af361f98..8725eb485e 100644 --- a/script/Makefile +++ b/script/Makefile @@ -419,10 +419,10 @@ OS_LOWER := $(shell echo $(OS) | tr '[:upper:]' '[:lower:]') endif lint: - GOGC=$(LINT_GOGC) golangci-lint run --config .golangci.yml --out-format colored-tab --deadline $(LINT_DEADLINE) --verbose + GOGC=$(LINT_GOGC) golangci-lint run --config .golangci.yml --out-format colored-tab --timeout $(LINT_DEADLINE) --verbose lint-fix: - GOGC=$(LINT_GOGC) golangci-lint run --config .golangci.yml --out-format colored-tab --deadline $(LINT_DEADLINE) --fix + GOGC=$(LINT_GOGC) golangci-lint run --config .golangci.yml --out-format colored-tab --timeout $(LINT_DEADLINE) --fix dir-licenses: ./script/vendor-license-directory.sh