Skip to content

Commit 4ce8307

Browse files
authored
Merge pull request #4771 from camilamacedo86/fix-lint-issue-error-stactick
🌱 fix staticcheck lint issues - ST1008 and ST1008
2 parents d4f3864 + 1f8677e commit 4ce8307

File tree

3 files changed

+17
-20
lines changed

3 files changed

+17
-20
lines changed

.golangci.yml

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -80,12 +80,6 @@ linters:
8080
- gosec
8181
- lll
8282
path: hack/docs/*
83-
- linters:
84-
- staticcheck
85-
text: "ST1008:"
86-
- linters:
87-
- staticcheck
88-
text: "ST1001:"
8983
- linters:
9084
- revive
9185
text: 'should have comment or be unexported'

pkg/machinery/scaffold_test.go

Lines changed: 16 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -167,35 +167,37 @@ var _ = Describe("Scaffold", func() {
167167
)
168168

169169
DescribeTable("file builders related errors",
170-
func(setup func() (error, []Builder)) {
171-
errType, files := setup()
170+
func(setup func() ([]Builder, error)) {
171+
files, errType := setup()
172172

173173
err := s.Execute(files...)
174174

175175
Expect(err).To(HaveOccurred())
176176
Expect(err).To(MatchError(errType))
177177
},
178-
Entry("should fail if unable to validate a file builder", func() (error, []Builder) {
179-
return ValidateError{testErr}, []Builder{
178+
Entry("should fail if unable to validate a file builder", func() ([]Builder, error) {
179+
return []Builder{
180180
fakeRequiresValidation{validateErr: testErr},
181-
}
181+
}, ValidateError{testErr}
182182
}),
183-
Entry("should fail if unable to set default values for a template", func() (error, []Builder) {
184-
return SetTemplateDefaultsError{testErr}, []Builder{
183+
184+
Entry("should fail if unable to set default values for a template", func() ([]Builder, error) {
185+
return []Builder{
185186
&fakeTemplate{err: testErr},
186-
}
187+
}, SetTemplateDefaultsError{testErr}
187188
}),
188-
Entry("should fail if an unexpected previous model is found", func() (error, []Builder) {
189-
return ModelAlreadyExistsError{path: path}, []Builder{
189+
190+
Entry("should fail if an unexpected previous model is found", func() ([]Builder, error) {
191+
return []Builder{
190192
&fakeTemplate{fakeBuilder: fakeBuilder{path: path}},
191193
&fakeTemplate{fakeBuilder: fakeBuilder{path: path, ifExistsAction: Error}},
192-
}
194+
}, ModelAlreadyExistsError{path: path}
193195
}),
194-
Entry("should fail if behavior if-exists-action is not defined", func() (error, []Builder) {
195-
return UnknownIfExistsActionError{path: path, ifExistsAction: -1}, []Builder{
196+
Entry("should fail if behavior if-exists-action is not defined", func() ([]Builder, error) {
197+
return []Builder{
196198
&fakeTemplate{fakeBuilder: fakeBuilder{path: path}},
197199
&fakeTemplate{fakeBuilder: fakeBuilder{path: path, ifExistsAction: -1}},
198-
}
200+
}, UnknownIfExistsActionError{path: path, ifExistsAction: -1}
199201
}),
200202
)
201203

test/e2e/utils/test_context.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ import (
2727
log "github.com/sirupsen/logrus"
2828
"sigs.k8s.io/kubebuilder/v4/pkg/plugin/util"
2929

30+
//nolint:staticcheck
3031
. "github.com/onsi/ginkgo/v2"
3132
)
3233

0 commit comments

Comments
 (0)