Skip to content

Commit

Permalink
chore: update golagci-lint to v1.158.0
Browse files Browse the repository at this point in the history
  • Loading branch information
lburgazzoli committed May 7, 2024
1 parent 37fb704 commit 0d95f03
Show file tree
Hide file tree
Showing 6 changed files with 22 additions and 12 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/validate.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
9 changes: 7 additions & 2 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@ linters-settings:
line-length: 170
run:
tests: false
skip-files:
issues:
exclude-files:
- test_support.go
linters:
enable-all: true
Expand All @@ -41,7 +42,7 @@ linters:
- goconst
- gocyclo
- godox
- goerr113
- err113
- gofumpt
- golint
- gomnd
Expand Down Expand Up @@ -73,3 +74,7 @@ linters:
- whitespace
- wrapcheck
- wsl
- execinquery
# TODO: too much work at this stage, but they should be re-enabled
- mnd
- perfsprint
10 changes: 5 additions & 5 deletions addons/master/master.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

Expand Down Expand Up @@ -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},
)
}
}
Expand Down
5 changes: 4 additions & 1 deletion pkg/apis/camel/v1/maven_types_support.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"`
Expand All @@ -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
}
Expand Down Expand Up @@ -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
}
Expand All @@ -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
}
Expand Down
2 changes: 2 additions & 0 deletions pkg/cmd/run.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
})
}
Expand Down
4 changes: 2 additions & 2 deletions script/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 0d95f03

Please sign in to comment.