diff --git a/.golangci.yml b/.golangci.yml index 1494ed99aaa..8b3c5306d28 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -35,7 +35,6 @@ linters-settings: - name: exported disabled: true # TODO: Investigate if it should be enabled. Disabled for now due to many findings. - name: if-return - disabled: true # TODO: Investigate if it should be enabled. Disabled for now due to many findings. - name: increment-decrement - name: var-naming - name: var-declaration diff --git a/pkg/cli/alpha/internal/generate.go b/pkg/cli/alpha/internal/generate.go index ba401af0a90..80c16b83262 100644 --- a/pkg/cli/alpha/internal/generate.go +++ b/pkg/cli/alpha/internal/generate.go @@ -81,12 +81,7 @@ func (opts *Generate) Generate() error { return err } } - - if err := migrateDeployImagePlugin(config); err != nil { - return err - } - - return nil + return migrateDeployImagePlugin(config) } // Validate ensures the options are valid and kubebuilder is installed. diff --git a/pkg/plugins/common/kustomize/v2/init.go b/pkg/plugins/common/kustomize/v2/init.go index 91e48fcbfd5..2143145d7d0 100644 --- a/pkg/plugins/common/kustomize/v2/init.go +++ b/pkg/plugins/common/kustomize/v2/init.go @@ -80,11 +80,7 @@ func (p *initSubcommand) InjectConfig(c config.Config) error { if err := validation.IsDNS1123Label(p.name); err != nil { return fmt.Errorf("project name (%s) is invalid: %v", p.name, err) } - if err := p.config.SetProjectName(p.name); err != nil { - return err - } - - return nil + return p.config.SetProjectName(p.name) } func (p *initSubcommand) Scaffold(fs machinery.Filesystem) error { diff --git a/pkg/plugins/golang/deploy-image/v1alpha1/api.go b/pkg/plugins/golang/deploy-image/v1alpha1/api.go index b93a6d6fb75..654881e7689 100644 --- a/pkg/plugins/golang/deploy-image/v1alpha1/api.go +++ b/pkg/plugins/golang/deploy-image/v1alpha1/api.go @@ -212,11 +212,7 @@ func (p *createAPISubcommand) Scaffold(fs machinery.Filesystem) error { Kind: p.resource.GVK.Kind, Options: configDataOptions, }) - if err := p.config.EncodePluginConfig(pluginKey, cfg); err != nil { - return err - } - - return nil + return p.config.EncodePluginConfig(pluginKey, cfg) } func (p *createAPISubcommand) PostScaffold() error { diff --git a/pkg/plugins/golang/deploy-image/v1alpha1/scaffolds/api.go b/pkg/plugins/golang/deploy-image/v1alpha1/scaffolds/api.go index 1bfe4eea7b3..304cc272334 100644 --- a/pkg/plugins/golang/deploy-image/v1alpha1/scaffolds/api.go +++ b/pkg/plugins/golang/deploy-image/v1alpha1/scaffolds/api.go @@ -130,11 +130,7 @@ func (s *apiScaffolder) Scaffold() error { return fmt.Errorf("error creating controller/**_controller_test.go: %v", err) } - if err := s.addEnvVarIntoManager(); err != nil { - return err - } - - return nil + return s.addEnvVarIntoManager() } // addEnvVarIntoManager will update the config/manager/manager.yaml by adding diff --git a/pkg/plugins/optional/helm/v1alpha/edit.go b/pkg/plugins/optional/helm/v1alpha/edit.go index bfaf357f3cb..aba26fc9ef4 100644 --- a/pkg/plugins/optional/helm/v1alpha/edit.go +++ b/pkg/plugins/optional/helm/v1alpha/edit.go @@ -82,9 +82,5 @@ func (p *editSubcommand) Scaffold(fs machinery.Filesystem) error { } // Track the resources following a declarative approach - if err := insertPluginMetaToConfig(p.config, pluginConfig{}); err != nil { - return err - } - - return nil + return insertPluginMetaToConfig(p.config, pluginConfig{}) } diff --git a/pkg/plugins/optional/helm/v1alpha/init.go b/pkg/plugins/optional/helm/v1alpha/init.go index 4f44a1241e0..cfeba16a856 100644 --- a/pkg/plugins/optional/helm/v1alpha/init.go +++ b/pkg/plugins/optional/helm/v1alpha/init.go @@ -55,9 +55,5 @@ func (p *initSubcommand) Scaffold(fs machinery.Filesystem) error { } // Track the resources following a declarative approach - if err := insertPluginMetaToConfig(p.config, pluginConfig{}); err != nil { - return err - } - - return nil + return insertPluginMetaToConfig(p.config, pluginConfig{}) } diff --git a/test/e2e/utils/kubectl.go b/test/e2e/utils/kubectl.go index dd1d770388a..76ada3053f8 100644 --- a/test/e2e/utils/kubectl.go +++ b/test/e2e/utils/kubectl.go @@ -135,10 +135,7 @@ func (v *KubernetesVersion) prepare() error { if err := v.ClientVersion.parseVersionInts(); err != nil { return err } - if err := v.ServerVersion.parseVersionInts(); err != nil { - return err - } - return nil + return v.ServerVersion.parseVersionInts() } // Version is a func to run kubectl version command @@ -158,8 +155,5 @@ func (v *KubernetesVersion) decode(out string) (err error) { if err := dec.Decode(&v); err != nil { return err } - if err := v.prepare(); err != nil { - return err - } - return nil + return v.prepare() }