Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: update golagci-lint to v1.158.0 #5471

Merged
merged 1 commit into from
May 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
10 changes: 8 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,8 @@ linters:
- whitespace
- wrapcheck
- wsl
- execinquery
# TODO: too much work at this stage as many files are impacted by the lint suggestions, however the reported
# lint violation make a lot of sense so we should re-enable the lints below and work to fix the findings
- 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
Loading