From 939807193a28dabe7b397e202b2e22ed2d6078d5 Mon Sep 17 00:00:00 2001 From: Camila Macedo Date: Thu, 9 Jan 2020 21:10:06 +0000 Subject: [PATCH] enable maligned lint check --- cmd/init_project.go | 17 +++++++++-------- pkg/scaffold/resource/resource.go | 6 +++--- pkg/scaffold/scaffold.go | 12 ++++++------ scripts/verify.sh | 2 +- 4 files changed, 19 insertions(+), 18 deletions(-) diff --git a/cmd/init_project.go b/cmd/init_project.go index 42d408a049a..6a6cebbbfae 100644 --- a/cmd/init_project.go +++ b/cmd/init_project.go @@ -68,21 +68,22 @@ kubebuilder init --domain example.org --license apache2 --owner "The Kubernetes } type projectOptions struct { - - // flags - fetchDeps bool - skipGoVersionCheck bool - boilerplate project.Boilerplate project project.Project + // final result + scaffolder scaffold.ProjectScaffolder + // deprecated flags - dep bool depFlag *flag.Flag depArgs []string - // final result - scaffolder scaffold.ProjectScaffolder + // flags + fetchDeps bool + skipGoVersionCheck bool + + // deprecated flags + dep bool } func (o *projectOptions) bindCmdlineFlags(cmd *cobra.Command) { diff --git a/pkg/scaffold/resource/resource.go b/pkg/scaffold/resource/resource.go index c69656f3c6c..3d869c8593c 100644 --- a/pkg/scaffold/resource/resource.go +++ b/pkg/scaffold/resource/resource.go @@ -26,9 +26,6 @@ import ( // Resource contains the information required to scaffold files for a resource. type Resource struct { - // Namespaced is true if the resource is namespaced - Namespaced bool - // Group is the API Group. Does not contain the domain. Group string @@ -50,6 +47,9 @@ type Resource struct { // CreateExampleReconcileBody will create a Deployment in the Reconcile example CreateExampleReconcileBody bool + + // Namespaced is true if the resource is namespaced + Namespaced bool } // Validate checks the Resource values to make sure they are valid. diff --git a/pkg/scaffold/scaffold.go b/pkg/scaffold/scaffold.go index 36ef6b91644..6b2d6b3bed6 100644 --- a/pkg/scaffold/scaffold.go +++ b/pkg/scaffold/scaffold.go @@ -50,22 +50,22 @@ type Scaffold struct { // Boilerplate is the contents of the boilerplate file for code generation Boilerplate string - BoilerplateOptional bool - // Project is the project Project input.ProjectFile - ProjectOptional bool - // ProjectPath is the relative path to the project root ProjectPath string GetWriter func(path string) (io.Writer, error) - FileExists func(path string) bool - // Plugins is the list of plugins we should allow to transform our generated scaffolding Plugins []Plugin + + FileExists func(path string) bool + + BoilerplateOptional bool + + ProjectOptional bool } // Plugin is the interface that a plugin must implement diff --git a/scripts/verify.sh b/scripts/verify.sh index e3f3eefe33b..d750bce6b0e 100755 --- a/scripts/verify.sh +++ b/scripts/verify.sh @@ -35,9 +35,9 @@ golangci-lint run --disable-all \ --enable=goimports \ --enable=gocyclo \ --enable=goconst \ + --enable=maligned \ ##todo(camilamacedo86): The following checks requires fixes in the code # --enable=golint # --enable=lll # --enable=gosec -# --enable=maligned