Skip to content

Commit 7561ccf

Browse files
🌱 fix lint issues on master (kubernetes-sigs#2316)
1 parent 5ca8884 commit 7561ccf

File tree

10 files changed

+30
-33
lines changed

10 files changed

+30
-33
lines changed

pkg/cli/cmd_helpers.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -285,6 +285,7 @@ func (factory *executionHooksFactory) preRunEFunc(
285285
}
286286

287287
// Pre-scaffold hook.
288+
// nolint:revive
288289
if err := factory.forEach(func(subcommand plugin.Subcommand) error {
289290
if subcommand, hasPreScaffold := subcommand.(plugin.HasPreScaffold); hasPreScaffold {
290291
return subcommand.PreScaffold(factory.fs)
@@ -302,6 +303,7 @@ func (factory *executionHooksFactory) preRunEFunc(
302303
func (factory *executionHooksFactory) runEFunc() func(*cobra.Command, []string) error {
303304
return func(*cobra.Command, []string) error {
304305
// Scaffold hook.
306+
// nolint:revive
305307
if err := factory.forEach(func(subcommand plugin.Subcommand) error {
306308
return subcommand.Scaffold(factory.fs)
307309
}, "unable to scaffold with"); err != nil {
@@ -321,6 +323,7 @@ func (factory *executionHooksFactory) postRunEFunc() func(*cobra.Command, []stri
321323
}
322324

323325
// Post-scaffold hook.
326+
// nolint:revive
324327
if err := factory.forEach(func(subcommand plugin.Subcommand) error {
325328
if subcommand, hasPostScaffold := subcommand.(plugin.HasPostScaffold); hasPostScaffold {
326329
return subcommand.PostScaffold()

pkg/machinery/scaffold.go

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -370,10 +370,7 @@ func filterExistingValues(content string, codeFragmentsMap CodeFragmentsMap) err
370370
}
371371
}
372372
}
373-
if err := scanner.Err(); err != nil {
374-
return err
375-
}
376-
return nil
373+
return scanner.Err()
377374
}
378375

379376
func insertStrings(content string, codeFragmentsMap CodeFragmentsMap) ([]byte, error) {

pkg/model/resource/resource.go

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -179,11 +179,8 @@ func (r *Resource) Update(other Resource) error {
179179
if r.Webhooks == nil && other.Webhooks != nil {
180180
r.Webhooks = &Webhooks{}
181181
}
182-
if err := r.Webhooks.Update(other.Webhooks); err != nil {
183-
return err
184-
}
185182

186-
return nil
183+
return r.Webhooks.Update(other.Webhooks)
187184
}
188185

189186
func wrapKey(key string) string {

pkg/plugins/common/kustomize/v1/init.go

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -97,9 +97,5 @@ func (p *initSubcommand) InjectConfig(c config.Config) error {
9797
func (p *initSubcommand) Scaffold(fs machinery.Filesystem) error {
9898
scaffolder := scaffolds.NewInitScaffolder(p.config)
9999
scaffolder.InjectFS(fs)
100-
if err := scaffolder.Scaffold(); err != nil {
101-
return err
102-
}
103-
104-
return nil
100+
return scaffolder.Scaffold()
105101
}

pkg/plugins/golang/v3/init.go

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -104,11 +104,8 @@ func (p *initSubcommand) InjectConfig(c config.Config) error {
104104
}
105105
p.repo = repoPath
106106
}
107-
if err := p.config.SetRepository(p.repo); err != nil {
108-
return err
109-
}
110107

111-
return nil
108+
return p.config.SetRepository(p.repo)
112109
}
113110

114111
func (p *initSubcommand) PreScaffold(machinery.Filesystem) error {
@@ -120,11 +117,7 @@ func (p *initSubcommand) PreScaffold(machinery.Filesystem) error {
120117
}
121118

122119
// Check if the current directory has not files or directories which does not allow to init the project
123-
if err := checkDir(); err != nil {
124-
return err
125-
}
126-
127-
return nil
120+
return checkDir()
128121
}
129122

130123
func (p *initSubcommand) Scaffold(fs machinery.Filesystem) error {

test/e2e/utils/kubectl.go

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -131,10 +131,7 @@ func (v *KubernetesVersion) prepare() (err error) {
131131
if err = v.ClientVersion.parseVersionInts(); err != nil {
132132
return err
133133
}
134-
if err = v.ServerVersion.parseVersionInts(); err != nil {
135-
return err
136-
}
137-
return nil
134+
return v.ServerVersion.parseVersionInts()
138135
}
139136

140137
// Version is a func to run kubectl version command

test/e2e/utils/test_context.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ import (
2424
"path/filepath"
2525
"strings"
2626

27-
. "github.com/onsi/ginkgo" //nolint:golint
27+
. "github.com/onsi/ginkgo" //nolint:golint,revive
2828
)
2929

3030
// TestContext specified to run e2e tests

test/e2e/v2/plugin_cluster_test.go

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,12 @@ import (
2525
"strings"
2626
"time"
2727

28-
. "github.com/onsi/ginkgo" //nolint:golint
29-
. "github.com/onsi/gomega" //nolint:golint
28+
//nolint:golint
29+
//nolint:revive
30+
. "github.com/onsi/ginkgo"
31+
//nolint:golint
32+
//nolint:revive
33+
. "github.com/onsi/gomega"
3034

3135
"sigs.k8s.io/kubebuilder/v3/test/e2e/utils"
3236
)

test/e2e/v3/generate_test.go

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,13 @@ import (
2222
"path/filepath"
2323
"strings"
2424

25-
. "github.com/onsi/ginkgo" //nolint:golint
26-
. "github.com/onsi/gomega" //nolint:golint
25+
//nolint:golint
26+
//nolint:revive
27+
. "github.com/onsi/ginkgo"
28+
29+
//nolint:golint
30+
//nolint:revive
31+
. "github.com/onsi/gomega"
2732

2833
"sigs.k8s.io/kubebuilder/v3/test/e2e/utils"
2934
)

test/e2e/v3/plugin_cluster_test.go

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,13 @@ import (
2525
"strings"
2626
"time"
2727

28-
. "github.com/onsi/ginkgo" //nolint:golint
29-
. "github.com/onsi/gomega" //nolint:golint
28+
//nolint:golint
29+
//nolint:revive
30+
. "github.com/onsi/ginkgo"
31+
32+
//nolint:golint
33+
//nolint:revive
34+
. "github.com/onsi/gomega"
3035

3136
"sigs.k8s.io/kubebuilder/v3/test/e2e/utils"
3237
)

0 commit comments

Comments
 (0)