diff --git a/pkg/cmd/apply/apply.go b/pkg/cmd/apply/apply.go index 385de5bd0..ed0540cc1 100644 --- a/pkg/cmd/apply/apply.go +++ b/pkg/cmd/apply/apply.go @@ -60,7 +60,7 @@ func NewCmdApply() (*cobra.Command, *Options) { Short: "Performs a GitOps regeneration and apply on a cluster git repository", Long: cmdLong, Example: fmt.Sprintf(cmdExample, rootcmd.BinaryName), - Run: func(cmd *cobra.Command, args []string) { + Run: func(_ *cobra.Command, _ []string) { err := o.Run() helper.CheckErr(err) }, diff --git a/pkg/cmd/condition/condition.go b/pkg/cmd/condition/condition.go index 13278debf..ea2c0b3b2 100644 --- a/pkg/cmd/condition/condition.go +++ b/pkg/cmd/condition/condition.go @@ -54,7 +54,7 @@ func NewCmdCondition() (*cobra.Command, *Options) { Short: "Runs a command if the condition is true", Long: cmdLong, Example: fmt.Sprintf(cmdExample, rootcmd.BinaryName, rootcmd.BinaryName), - Run: func(cmd *cobra.Command, args []string) { + Run: func(_ *cobra.Command, args []string) { o.Args = args err := o.Run() helper.CheckErr(err) diff --git a/pkg/cmd/copy/copy.go b/pkg/cmd/copy/copy.go index 4024e1a5c..28e584abe 100644 --- a/pkg/cmd/copy/copy.go +++ b/pkg/cmd/copy/copy.go @@ -64,7 +64,7 @@ func NewCmdCopy() (*cobra.Command, *Options) { Short: "Copies resources (by default confimaps) with the given selector or name from a source namespace to a destination namespace", Long: cmdLong, Example: fmt.Sprintf(cmdExample, rootcmd.BinaryName, rootcmd.BinaryName, rootcmd.BinaryName), - Run: func(cmd *cobra.Command, args []string) { + Run: func(_ *cobra.Command, _ []string) { err := o.Run() helper.CheckErr(err) }, diff --git a/pkg/cmd/gc/activities/activities.go b/pkg/cmd/gc/activities/activities.go index 95edea471..b399dd8da 100644 --- a/pkg/cmd/gc/activities/activities.go +++ b/pkg/cmd/gc/activities/activities.go @@ -96,7 +96,7 @@ func NewCmdGCActivities() (*cobra.Command, *Options) { Short: "garbage collection for PipelineActivity resources", Long: cmdLong, Example: cmdExample, - Run: func(cmd *cobra.Command, args []string) { + Run: func(_ *cobra.Command, _ []string) { err := o.Run() helper.CheckErr(err) }, diff --git a/pkg/cmd/gc/gc.go b/pkg/cmd/gc/gc.go index 05757ede8..ab2b9b1d2 100644 --- a/pkg/cmd/gc/gc.go +++ b/pkg/cmd/gc/gc.go @@ -14,7 +14,7 @@ func NewCmdGC() *cobra.Command { command := &cobra.Command{ Use: "gc", Short: "Commands for garbage collecting resources", - Run: func(command *cobra.Command, args []string) { + Run: func(command *cobra.Command, _ []string) { err := command.Help() if err != nil { log.Logger().Errorf(err.Error()) diff --git a/pkg/cmd/gc/jobs/jobs.go b/pkg/cmd/gc/jobs/jobs.go index d708bd2e0..ae9f6e347 100644 --- a/pkg/cmd/gc/jobs/jobs.go +++ b/pkg/cmd/gc/jobs/jobs.go @@ -59,7 +59,7 @@ func NewCmdGCJobs() (*cobra.Command, *Options) { Aliases: []string{"job"}, Long: cmdLong, Example: cmdExample, - Run: func(cmd *cobra.Command, args []string) { + Run: func(_ *cobra.Command, _ []string) { err := o.Run() helper.CheckErr(err) }, diff --git a/pkg/cmd/gc/pods/pods.go b/pkg/cmd/gc/pods/pods.go index eec5c8510..568edfde3 100644 --- a/pkg/cmd/gc/pods/pods.go +++ b/pkg/cmd/gc/pods/pods.go @@ -50,7 +50,7 @@ func NewCmdGCPods() (*cobra.Command, *Options) { Aliases: []string{"pod"}, Long: cmdLong, Example: cmdExample, - Run: func(cmd *cobra.Command, args []string) { + Run: func(_ *cobra.Command, _ []string) { err := o.Run() helper.CheckErr(err) }, diff --git a/pkg/cmd/git/clone/clone.go b/pkg/cmd/git/clone/clone.go index 6a4384085..d7cea14a0 100644 --- a/pkg/cmd/git/clone/clone.go +++ b/pkg/cmd/git/clone/clone.go @@ -48,7 +48,7 @@ func NewCmdGitClone() (*cobra.Command, *Options) { Short: "Clones the cluster git repository using the URL, git user and token from the Secret", Long: cmdLong, Example: fmt.Sprintf(cmdExample, rootcmd.BinaryName), - Run: func(cmd *cobra.Command, args []string) { + Run: func(_ *cobra.Command, _ []string) { err := o.Run() helper.CheckErr(err) }, diff --git a/pkg/cmd/git/get/get.go b/pkg/cmd/git/get/get.go index bb8d72786..5365807d3 100644 --- a/pkg/cmd/git/get/get.go +++ b/pkg/cmd/git/get/get.go @@ -72,7 +72,7 @@ func NewCmdGitGet() (*cobra.Command, *Options) { Short: "Gets a file from a git repository or environment git repository", Long: cmdLong, Example: fmt.Sprintf(cmdExample, rootcmd.BinaryName), - Run: func(cmd *cobra.Command, args []string) { + Run: func(_ *cobra.Command, _ []string) { err := o.Run() helper.CheckErr(err) }, diff --git a/pkg/cmd/git/git.go b/pkg/cmd/git/git.go index 09d1b0090..0821e21e3 100644 --- a/pkg/cmd/git/git.go +++ b/pkg/cmd/git/git.go @@ -15,7 +15,7 @@ func NewCmdGit() *cobra.Command { command := &cobra.Command{ Use: "git", Short: "Commands for working with Git", - Run: func(command *cobra.Command, args []string) { + Run: func(command *cobra.Command, _ []string) { err := command.Help() if err != nil { log.Logger().Errorf(err.Error()) diff --git a/pkg/cmd/git/merge/merge.go b/pkg/cmd/git/merge/merge.go index 599862a96..6b4a34a33 100644 --- a/pkg/cmd/git/merge/merge.go +++ b/pkg/cmd/git/merge/merge.go @@ -73,7 +73,7 @@ func NewCmdGitMerge() (*cobra.Command, *Options) { Short: "Merge a number of SHAs into the HEAD of the main branch", Long: cmdLong, Example: fmt.Sprintf(cmdExample, rootcmd.BinaryName), - Run: func(cmd *cobra.Command, args []string) { + Run: func(_ *cobra.Command, _ []string) { err := o.Run() helper.CheckErr(err) }, diff --git a/pkg/cmd/git/setup/setup.go b/pkg/cmd/git/setup/setup.go index 09f487a42..2f5b48123 100644 --- a/pkg/cmd/git/setup/setup.go +++ b/pkg/cmd/git/setup/setup.go @@ -103,7 +103,7 @@ func NewCmdGitSetup() (*cobra.Command, *Options) { Short: "Sets up git to ensure the git user name and email is setup", Long: cmdLong, Example: fmt.Sprintf(cmdExample, rootcmd.BinaryName), - Run: func(cmd *cobra.Command, args []string) { + Run: func(_ *cobra.Command, _ []string) { err := o.Run() helper.CheckErr(err) }, diff --git a/pkg/cmd/hash/hash.go b/pkg/cmd/hash/hash.go index 84c192e76..245750b93 100644 --- a/pkg/cmd/hash/hash.go +++ b/pkg/cmd/hash/hash.go @@ -47,7 +47,7 @@ func NewCmdHashAnnotate() (*cobra.Command, *Options) { Short: "Annotates the given files with a hash of the given source files for ConfigMaps/Secrets", Long: cmdLong, Example: fmt.Sprintf(cmdExample, rootcmd.BinaryName), - Run: func(cmd *cobra.Command, args []string) { + Run: func(_ *cobra.Command, _ []string) { err := o.Run() helper.CheckErr(err) }, diff --git a/pkg/cmd/helm/build/build.go b/pkg/cmd/helm/build/build.go index 5f6f94377..6bf7f5261 100644 --- a/pkg/cmd/helm/build/build.go +++ b/pkg/cmd/helm/build/build.go @@ -51,7 +51,7 @@ func NewCmdHelmBuild() (*cobra.Command, *Options) { Short: "Builds and lints any helm charts", Long: cmdLong, Example: fmt.Sprintf(cmdExample, rootcmd.BinaryName), - Run: func(cmd *cobra.Command, args []string) { + Run: func(_ *cobra.Command, _ []string) { err := o.Run() helper.CheckErr(err) }, diff --git a/pkg/cmd/helm/escape/escape.go b/pkg/cmd/helm/escape/escape.go index 7ffe6298b..560456e04 100644 --- a/pkg/cmd/helm/escape/escape.go +++ b/pkg/cmd/helm/escape/escape.go @@ -41,7 +41,7 @@ func NewCmdEscape() (*cobra.Command, *Options) { Short: "Escapes any {{ or }} characters in the YAML files so they can be included in a helm chart", Long: cmdLong, Example: fmt.Sprintf(cmdExample, rootcmd.BinaryName), - Run: func(cmd *cobra.Command, args []string) { + Run: func(_ *cobra.Command, _ []string) { err := o.Run() helper.CheckErr(err) }, diff --git a/pkg/cmd/helm/helm.go b/pkg/cmd/helm/helm.go index ad315cb31..f8a011a64 100644 --- a/pkg/cmd/helm/helm.go +++ b/pkg/cmd/helm/helm.go @@ -15,7 +15,7 @@ func NewCmdHelm() *cobra.Command { command := &cobra.Command{ Use: "helm", Short: "Commands for working with helm charts", - Run: func(command *cobra.Command, args []string) { + Run: func(command *cobra.Command, _ []string) { err := command.Help() if err != nil { log.Logger().Errorf(err.Error()) diff --git a/pkg/cmd/helm/mirror/mirror.go b/pkg/cmd/helm/mirror/mirror.go index e53904f96..818b2e846 100644 --- a/pkg/cmd/helm/mirror/mirror.go +++ b/pkg/cmd/helm/mirror/mirror.go @@ -64,7 +64,7 @@ func NewCmdMirror() (*cobra.Command, *Options) { Short: "Creates a helm mirror ", Long: cmdLong, Example: fmt.Sprintf(cmdExample, rootcmd.BinaryName), - Run: func(cmd *cobra.Command, args []string) { + Run: func(_ *cobra.Command, _ []string) { err := o.Run() helper.CheckErr(err) }, diff --git a/pkg/cmd/helm/release/release.go b/pkg/cmd/helm/release/release.go index d4cfd3162..373073eca 100644 --- a/pkg/cmd/helm/release/release.go +++ b/pkg/cmd/helm/release/release.go @@ -113,7 +113,7 @@ func NewCmdHelmRelease() (*cobra.Command, *Options) { Short: "Performs a release of all the charts in the charts folder", Long: cmdLong, Example: fmt.Sprintf(cmdExample, rootcmd.BinaryName), - Run: func(cmd *cobra.Command, args []string) { + Run: func(_ *cobra.Command, _ []string) { err := o.Run() helper.CheckErr(err) }, diff --git a/pkg/cmd/helm/step_helm_template.go b/pkg/cmd/helm/step_helm_template.go index 45eaecc2d..a1d9da36c 100644 --- a/pkg/cmd/helm/step_helm_template.go +++ b/pkg/cmd/helm/step_helm_template.go @@ -62,7 +62,7 @@ func NewCmdHelmTemplate() (*cobra.Command, *TemplateOptions) { Short: "Generate the kubernetes resources from a helm chart", Long: helmTemplateLong, Example: fmt.Sprintf(helmTemplateExample, rootcmd.BinaryName), - Run: func(cmd *cobra.Command, args []string) { + Run: func(_ *cobra.Command, _ []string) { err := o.Run() helper.CheckErr(err) }, diff --git a/pkg/cmd/helmfile/add/add.go b/pkg/cmd/helmfile/add/add.go index f1eef956e..705abf4b9 100644 --- a/pkg/cmd/helmfile/add/add.go +++ b/pkg/cmd/helmfile/add/add.go @@ -50,7 +50,7 @@ func NewCmdHelmfileAdd() (*cobra.Command, *Options) { Short: "Adds a chart to the local 'helmfile.yaml' file", Long: cmdLong, Example: fmt.Sprintf(cmdExample, rootcmd.BinaryName, rootcmd.BinaryName), - Run: func(cmd *cobra.Command, args []string) { + Run: func(_ *cobra.Command, _ []string) { err := o.Run() helper.CheckErr(err) }, diff --git a/pkg/cmd/helmfile/deletecmd/delete.go b/pkg/cmd/helmfile/deletecmd/delete.go index 34d3aa0c9..04e77a7d6 100644 --- a/pkg/cmd/helmfile/deletecmd/delete.go +++ b/pkg/cmd/helmfile/deletecmd/delete.go @@ -53,7 +53,7 @@ func NewCmdHelmfileDelete() (*cobra.Command, *Options) { Short: "Deletes a chart from the helmfiles in one or all namespaces", Long: cmdLong, Example: cmdExample, - RunE: func(cmd *cobra.Command, args []string) error { + RunE: func(_ *cobra.Command, _ []string) error { return o.Run() }, } diff --git a/pkg/cmd/helmfile/helmfile.go b/pkg/cmd/helmfile/helmfile.go index 6d0e626a5..2b73a4b32 100644 --- a/pkg/cmd/helmfile/helmfile.go +++ b/pkg/cmd/helmfile/helmfile.go @@ -20,7 +20,7 @@ func NewCmdHelmfile() *cobra.Command { Use: "helmfile", Short: "Commands for working with helmfile", Aliases: []string{"helmfiles"}, - Run: func(command *cobra.Command, args []string) { + Run: func(command *cobra.Command, _ []string) { err := command.Help() if err != nil { log.Logger().Errorf(err.Error()) diff --git a/pkg/cmd/helmfile/move/move.go b/pkg/cmd/helmfile/move/move.go index dcc9d849c..ae285f0d2 100644 --- a/pkg/cmd/helmfile/move/move.go +++ b/pkg/cmd/helmfile/move/move.go @@ -77,7 +77,7 @@ func NewCmdHelmfileMove() (*cobra.Command, *Options) { Short: "Moves the generated template files from 'helmfile template' into the right gitops directory", Long: namespaceLong, Example: fmt.Sprintf(namespaceExample, rootcmd.BinaryName), - Run: func(cmd *cobra.Command, args []string) { + Run: func(_ *cobra.Command, _ []string) { err := o.Run() helper.CheckErr(err) }, diff --git a/pkg/cmd/helmfile/report/report.go b/pkg/cmd/helmfile/report/report.go index d46ea06fc..5604058d5 100644 --- a/pkg/cmd/helmfile/report/report.go +++ b/pkg/cmd/helmfile/report/report.go @@ -83,7 +83,7 @@ func NewCmdHelmfileReport() (*cobra.Command, *Options) { Short: "Generates a markdown report of the helmfile based deployments in each namespace", Long: cmdLong, Example: fmt.Sprintf(cmdExample, rootcmd.BinaryName), - Run: func(cmd *cobra.Command, args []string) { + Run: func(_ *cobra.Command, _ []string) { err := o.Run() helper.CheckErr(err) }, diff --git a/pkg/cmd/helmfile/resolve/resolve.go b/pkg/cmd/helmfile/resolve/resolve.go index 25f3aa7d1..59b41cda1 100644 --- a/pkg/cmd/helmfile/resolve/resolve.go +++ b/pkg/cmd/helmfile/resolve/resolve.go @@ -90,7 +90,7 @@ func NewCmdHelmfileResolve() (*cobra.Command, *Options) { Short: "Resolves any missing versions or values files in the helmfile.yaml file from the version stream", Long: cmdLong, Example: fmt.Sprintf(cmdExample, rootcmd.BinaryName), - Run: func(cmd *cobra.Command, args []string) { + Run: func(_ *cobra.Command, _ []string) { err := o.Run() helper.CheckErr(err) }, diff --git a/pkg/cmd/helmfile/status/status.go b/pkg/cmd/helmfile/status/status.go index 0c9083e48..ef2ea3005 100644 --- a/pkg/cmd/helmfile/status/status.go +++ b/pkg/cmd/helmfile/status/status.go @@ -72,7 +72,7 @@ func NewCmdHelmfileStatus() (*cobra.Command, *Options) { Short: "Updates the git deployment status after a release", Long: statusLong, Example: fmt.Sprintf(statusExample, rootcmd.BinaryName), - Run: func(cmd *cobra.Command, args []string) { + Run: func(_ *cobra.Command, _ []string) { err := o.Run() helper.CheckErr(err) }, diff --git a/pkg/cmd/helmfile/structure/structure.go b/pkg/cmd/helmfile/structure/structure.go index 024a7a98e..b7523074c 100644 --- a/pkg/cmd/helmfile/structure/structure.go +++ b/pkg/cmd/helmfile/structure/structure.go @@ -48,7 +48,7 @@ func NewCmdHelmfileStructure() (*cobra.Command, *Options) { Short: "Runs 'helmfile structure' on the helmfile in specified directory which will split in to multiple helmfiles based around namespace", Long: cmdLong, Example: fmt.Sprintf(cmdExample, rootcmd.BinaryName), - Run: func(cmd *cobra.Command, args []string) { + Run: func(_ *cobra.Command, _ []string) { err := o.Run() helper.CheckErr(err) }, diff --git a/pkg/cmd/helmfile/validate/validate.go b/pkg/cmd/helmfile/validate/validate.go index 15b9a9c17..5a0738a0b 100644 --- a/pkg/cmd/helmfile/validate/validate.go +++ b/pkg/cmd/helmfile/validate/validate.go @@ -40,7 +40,7 @@ func NewCmdHelmfileValidate() (*cobra.Command, *Options) { Short: "Validates helmfile.yaml against a jx canonical tree of helmfiles", Long: cmdLong, Example: fmt.Sprintf(cmdExample, rootcmd.BinaryName, rootcmd.BinaryName), - Run: func(cmd *cobra.Command, args []string) { + Run: func(_ *cobra.Command, _ []string) { err := o.Run() helper.CheckErr(err) }, diff --git a/pkg/cmd/image/image.go b/pkg/cmd/image/image.go index 511e78e4d..2486e5828 100644 --- a/pkg/cmd/image/image.go +++ b/pkg/cmd/image/image.go @@ -80,7 +80,7 @@ func NewCmdUpdateImage() (*cobra.Command, *Options) { Short: "Updates images in the kubernetes resources from the version stream", Long: cmdLong, Example: fmt.Sprintf(cmdExample, rootcmd.BinaryName, rootcmd.BinaryName), - Run: func(cmd *cobra.Command, args []string) { + Run: func(_ *cobra.Command, _ []string) { err := o.Run() helper.CheckErr(err) }, @@ -195,7 +195,7 @@ func (o *Options) modifyImages(node *yaml.RNode, filePath, jsonPath string, name } // resolveImage resolves the given container image from the version stream -func (o *Options) resolveImage(image string, names []string, filePath string) (string, error) { +func (o *Options) resolveImage(image string, _ []string, _ string) (string, error) { resolver := o.VersionStreamer.Resolver if resolver == nil { return "", errors.Errorf("cannot resolve image %s as no VersionResolver configured", image) diff --git a/pkg/cmd/ingress/ingress.go b/pkg/cmd/ingress/ingress.go index ef45af91f..b1fb54657 100644 --- a/pkg/cmd/ingress/ingress.go +++ b/pkg/cmd/ingress/ingress.go @@ -48,7 +48,7 @@ func NewCmdUpdateIngress() (*cobra.Command, *Options) { Short: "Updates Ingress resources with the current ingress domain", Long: ingressLong, Example: fmt.Sprintf(ingressExample, rootcmd.BinaryName), - Run: func(cmd *cobra.Command, args []string) { + Run: func(_ *cobra.Command, _ []string) { err := o.Run() helper.CheckErr(err) }, diff --git a/pkg/cmd/jenkins/add/add.go b/pkg/cmd/jenkins/add/add.go index 9122aa95c..724c821b1 100644 --- a/pkg/cmd/jenkins/add/add.go +++ b/pkg/cmd/jenkins/add/add.go @@ -59,7 +59,7 @@ func NewCmdJenkinsAdd() (*cobra.Command, *Options) { Short: "Adds a new Jenkins server to the git repository", Long: cmdLong, Example: fmt.Sprintf(cmdExample, rootcmd.BinaryName), - Run: func(cmd *cobra.Command, args []string) { + Run: func(_ *cobra.Command, _ []string) { err := o.Run() helper.CheckErr(err) }, diff --git a/pkg/cmd/jenkins/jenkins.go b/pkg/cmd/jenkins/jenkins.go index f980dc23c..3b6a7e4ff 100644 --- a/pkg/cmd/jenkins/jenkins.go +++ b/pkg/cmd/jenkins/jenkins.go @@ -13,7 +13,7 @@ func NewCmdJenkins() *cobra.Command { command := &cobra.Command{ Use: "jenkins", Short: "Commands for working with Jenkins GitOps configuration", - Run: func(command *cobra.Command, args []string) { + Run: func(command *cobra.Command, _ []string) { err := command.Help() if err != nil { log.Logger().Errorf(err.Error()) diff --git a/pkg/cmd/jenkins/jobs/jobs.go b/pkg/cmd/jenkins/jobs/jobs.go index 87ecf1db0..618174bc0 100644 --- a/pkg/cmd/jenkins/jobs/jobs.go +++ b/pkg/cmd/jenkins/jobs/jobs.go @@ -80,7 +80,7 @@ func NewCmdJenkinsJobs() (*cobra.Command, *Options) { Short: "Generates the Jenkins Jobs helm files", Long: cmdLong, Example: fmt.Sprintf(cmdExample, rootcmd.BinaryName), - Run: func(cmd *cobra.Command, args []string) { + Run: func(_ *cobra.Command, _ []string) { err := o.Run() helper.CheckErr(err) }, diff --git a/pkg/cmd/kpt/kpt.go b/pkg/cmd/kpt/kpt.go index 6f69712ed..a1fbf5e94 100644 --- a/pkg/cmd/kpt/kpt.go +++ b/pkg/cmd/kpt/kpt.go @@ -13,7 +13,7 @@ func NewCmdKpt() *cobra.Command { command := &cobra.Command{ Use: "kpt", Short: "Commands for working with kpt packages", - Run: func(command *cobra.Command, args []string) { + Run: func(command *cobra.Command, _ []string) { err := command.Help() if err != nil { log.Logger().Errorf(err.Error()) diff --git a/pkg/cmd/kpt/recreate/recreate.go b/pkg/cmd/kpt/recreate/recreate.go index 43d261a64..7fe836009 100644 --- a/pkg/cmd/kpt/recreate/recreate.go +++ b/pkg/cmd/kpt/recreate/recreate.go @@ -50,7 +50,7 @@ func NewCmdKptRecreate() (*cobra.Command, *Options) { Short: "Recreates the kpt packages in the given directory", Long: kptLong, Example: fmt.Sprintf(kptExample, rootcmd.BinaryName), - Run: func(cmd *cobra.Command, args []string) { + Run: func(_ *cobra.Command, _ []string) { err := o.Run() helper.CheckErr(err) }, diff --git a/pkg/cmd/kpt/update/update.go b/pkg/cmd/kpt/update/update.go index 5705e8b1d..7c1aa97a8 100644 --- a/pkg/cmd/kpt/update/update.go +++ b/pkg/cmd/kpt/update/update.go @@ -77,7 +77,7 @@ func NewCmdKptUpdate() (*cobra.Command, *Options) { Short: "Updates any kpt packages installed in a sub directory", Long: kptLong, Example: fmt.Sprintf(kptExample, rootcmd.BinaryName), - Run: func(cmd *cobra.Command, args []string) { + Run: func(_ *cobra.Command, _ []string) { err := o.Run() helper.CheckErr(err) }, diff --git a/pkg/cmd/kustomize/kustomize.go b/pkg/cmd/kustomize/kustomize.go index 4d05c1e4c..6dfbc4340 100644 --- a/pkg/cmd/kustomize/kustomize.go +++ b/pkg/cmd/kustomize/kustomize.go @@ -58,7 +58,7 @@ func NewCmdKustomize() (*cobra.Command, *Options) { Short: "Generates a kustomize layout by comparing a source and target directories", Long: splitLong, Example: fmt.Sprintf(splitExample, rootcmd.BinaryName), - Run: func(cmd *cobra.Command, args []string) { + Run: func(_ *cobra.Command, _ []string) { err := o.Run() helper.CheckErr(err) }, @@ -187,7 +187,7 @@ func (o *Options) createOverlay(srcNode, targetNode *yaml.RNode, path string) (* if overlay != nil { count := 0 // lets verify we don't only contain mandatory fields - err = walkMappingNodes(overlay, "", func(node *yaml.Node, jsonPath string) error { + err = walkMappingNodes(overlay, "", func(_ *yaml.Node, jsonPath string) error { if jsonPath != "" && jsonPath != "metadata" && stringhelpers.StringArrayIndex(mandatoryFields, jsonPath) < 0 { if count == 0 { fmt.Printf("path %s has non mandatory path %s\n", path, jsonPath) diff --git a/pkg/cmd/lint/lint.go b/pkg/cmd/lint/lint.go index dd40f1d52..0b58d167a 100644 --- a/pkg/cmd/lint/lint.go +++ b/pkg/cmd/lint/lint.go @@ -44,7 +44,7 @@ func NewCmdLint() (*cobra.Command, *Options) { Short: "Lints the gitops files in the file system", Long: splitLong, Example: fmt.Sprintf(splitExample, rootcmd.BinaryName), - Run: func(cmd *cobra.Command, args []string) { + Run: func(_ *cobra.Command, _ []string) { err := o.Run() helper.CheckErr(err) }, diff --git a/pkg/cmd/namespace/namespace.go b/pkg/cmd/namespace/namespace.go index 59bf201fc..7fcb03206 100644 --- a/pkg/cmd/namespace/namespace.go +++ b/pkg/cmd/namespace/namespace.go @@ -58,7 +58,7 @@ func NewCmdUpdateNamespace() (*cobra.Command, *Options) { Short: "Updates all kubernetes resources in the given directory to the given namespace", Long: namespaceLong, Example: fmt.Sprintf(namespaceExample, rootcmd.BinaryName, rootcmd.BinaryName), - Run: func(cmd *cobra.Command, args []string) { + Run: func(_ *cobra.Command, _ []string) { err := o.Run() helper.CheckErr(err) }, diff --git a/pkg/cmd/patch/patch.go b/pkg/cmd/patch/patch.go index 9894f3b9c..92de3aaf3 100644 --- a/pkg/cmd/patch/patch.go +++ b/pkg/cmd/patch/patch.go @@ -59,7 +59,7 @@ func NewCmdPatch() (*cobra.Command, *Options) { Short: "Patches the given resources", Long: annotateLong, Example: fmt.Sprintf(annotateExample, rootcmd.BinaryName, rootcmd.BinaryName), - Run: func(cmd *cobra.Command, args []string) { + Run: func(_ *cobra.Command, _ []string) { err := o.Run() helper.CheckErr(err) }, diff --git a/pkg/cmd/plugin/get/get.go b/pkg/cmd/plugin/get/get.go index 4dae1ddb9..0e680bf58 100644 --- a/pkg/cmd/plugin/get/get.go +++ b/pkg/cmd/plugin/get/get.go @@ -38,7 +38,7 @@ func NewCmdPluginGet() (*cobra.Command, *Options) { Long: cmdLong, Example: cmdExample, Aliases: []string{"list", "ls"}, - Run: func(cmd *cobra.Command, args []string) { + Run: func(_ *cobra.Command, _ []string) { err := o.Run() helper.CheckErr(err) }, diff --git a/pkg/cmd/plugin/plugin.go b/pkg/cmd/plugin/plugin.go index abbef3d8a..d3569b6f5 100644 --- a/pkg/cmd/plugin/plugin.go +++ b/pkg/cmd/plugin/plugin.go @@ -13,7 +13,7 @@ func NewCmdPlugin() *cobra.Command { command := &cobra.Command{ Use: "plugin", Short: "Commands for working with plugins", - Run: func(command *cobra.Command, args []string) { + Run: func(command *cobra.Command, _ []string) { err := command.Help() if err != nil { log.Logger().Errorf(err.Error()) diff --git a/pkg/cmd/plugin/upgrade/upgrade.go b/pkg/cmd/plugin/upgrade/upgrade.go index 7d5d0b8fe..ea8524398 100644 --- a/pkg/cmd/plugin/upgrade/upgrade.go +++ b/pkg/cmd/plugin/upgrade/upgrade.go @@ -47,7 +47,7 @@ func NewCmdUpgradePlugins() (*cobra.Command, *Options) { Short: "Upgrades the binary plugins for this plugin", Long: cmdPluginsLong, Example: fmt.Sprintf(cmdPluginsExample, rootcmd.BinaryName), - Run: func(cmd *cobra.Command, args []string) { + Run: func(_ *cobra.Command, _ []string) { err := o.Run() helper.CheckErr(err) }, diff --git a/pkg/cmd/postprocess/postprocess.go b/pkg/cmd/postprocess/postprocess.go index efeb761e4..37804f5f8 100644 --- a/pkg/cmd/postprocess/postprocess.go +++ b/pkg/cmd/postprocess/postprocess.go @@ -58,7 +58,7 @@ func NewCmdPostProcess() (*cobra.Command, *Options) { Short: "Post processes kubernetes resources to enrich resources like ServiceAccounts with cloud specific sensitive data to enable IAM rles", Long: cmdLong, Example: fmt.Sprintf(cmdExample, rootcmd.BinaryName, rootcmd.BinaryName), - Run: func(cmd *cobra.Command, args []string) { + Run: func(_ *cobra.Command, _ []string) { err := o.Run() helper.CheckErr(err) }, diff --git a/pkg/cmd/pr/comment/comment.go b/pkg/cmd/pr/comment/comment.go index d5f646b19..02dabbb6a 100644 --- a/pkg/cmd/pr/comment/comment.go +++ b/pkg/cmd/pr/comment/comment.go @@ -61,7 +61,7 @@ func NewCmdPullRequestComment() (*cobra.Command, *Options) { Short: "Add comment to the pull request", Long: cmdLong, Example: fmt.Sprintf(cmdExample, rootcmd.BinaryName), - Run: func(cmd *cobra.Command, args []string) { + Run: func(_ *cobra.Command, _ []string) { err := o.Run() helper.CheckErr(err) }, diff --git a/pkg/cmd/pr/get/get.go b/pkg/cmd/pr/get/get.go index 78a65bb27..75a141c32 100644 --- a/pkg/cmd/pr/get/get.go +++ b/pkg/cmd/pr/get/get.go @@ -43,7 +43,7 @@ func NewCmdPullRequestGet() (*cobra.Command, *Options) { Short: "Gets a pull request and displays fields from it", Long: cmdLong, Example: fmt.Sprintf(cmdExample, rootcmd.BinaryName), - Run: func(cmd *cobra.Command, args []string) { + Run: func(_ *cobra.Command, _ []string) { err := o.Run() helper.CheckErr(err) }, diff --git a/pkg/cmd/pr/label/label.go b/pkg/cmd/pr/label/label.go index c58cb5f7d..6611fe50e 100644 --- a/pkg/cmd/pr/label/label.go +++ b/pkg/cmd/pr/label/label.go @@ -57,7 +57,7 @@ func NewCmdPullRequestLabel() (*cobra.Command, *Options) { Short: "Add label to the pull request", Long: cmdLong, Example: fmt.Sprintf(cmdExample, rootcmd.BinaryName, rootcmd.BinaryName), - Run: func(cmd *cobra.Command, args []string) { + Run: func(_ *cobra.Command, _ []string) { err := o.Run() helper.CheckErr(err) }, diff --git a/pkg/cmd/pr/label/label_test.go b/pkg/cmd/pr/label/label_test.go index 1c4938751..d834494bc 100644 --- a/pkg/cmd/pr/label/label_test.go +++ b/pkg/cmd/pr/label/label_test.go @@ -21,48 +21,48 @@ func TestPullRequestLabel(t *testing.T) { }{ { name: "already has label", - init: func(o *label.Options, pr *scm.PullRequest, fakeData *fake.Data) { + init: func(o *label.Options, pr *scm.PullRequest, _ *fake.Data) { o.Label = "mylabel" pr.Labels = append(pr.Labels, &scm.Label{ Name: "mylabel", }) }, - verify: func(o *label.Options, pr *scm.PullRequest) { + verify: func(o *label.Options, _ *scm.PullRequest) { assert.False(t, o.LabelAdded) }, }, { name: "add label", - init: func(o *label.Options, pr *scm.PullRequest, fakeData *fake.Data) { + init: func(o *label.Options, _ *scm.PullRequest, _ *fake.Data) { o.Label = "mylabel" }, - verify: func(o *label.Options, pr *scm.PullRequest) { + verify: func(o *label.Options, _ *scm.PullRequest) { assert.True(t, o.LabelAdded) }, }, { name: "add label if matching", - init: func(o *label.Options, pr *scm.PullRequest, fakeData *fake.Data) { + init: func(o *label.Options, pr *scm.PullRequest, _ *fake.Data) { o.Label = "mylabel" o.Regex = "env/.*" pr.Labels = append(pr.Labels, &scm.Label{ Name: "env/staging", }) }, - verify: func(o *label.Options, pr *scm.PullRequest) { + verify: func(o *label.Options, _ *scm.PullRequest) { assert.True(t, o.LabelAdded) }, }, { name: "not add label as not matching", - init: func(o *label.Options, pr *scm.PullRequest, fakeData *fake.Data) { + init: func(o *label.Options, pr *scm.PullRequest, _ *fake.Data) { o.Label = "mylabel" o.Regex = "env/.*" pr.Labels = append(pr.Labels, &scm.Label{ Name: "somethingElse", }) }, - verify: func(o *label.Options, pr *scm.PullRequest) { + verify: func(o *label.Options, _ *scm.PullRequest) { assert.False(t, o.LabelAdded) }, }, diff --git a/pkg/cmd/pr/pr.go b/pkg/cmd/pr/pr.go index fcea105a0..b6fb442a9 100644 --- a/pkg/cmd/pr/pr.go +++ b/pkg/cmd/pr/pr.go @@ -17,7 +17,7 @@ func NewCmdPR() *cobra.Command { Use: "pr", Short: "Commands for working with Pull Requests", Aliases: []string{"pullrequest", "pullrequests"}, - Run: func(command *cobra.Command, args []string) { + Run: func(command *cobra.Command, _ []string) { err := command.Help() if err != nil { log.Logger().Errorf(err.Error()) diff --git a/pkg/cmd/pr/push/push.go b/pkg/cmd/pr/push/push.go index 19f6ad34c..f715bdcac 100644 --- a/pkg/cmd/pr/push/push.go +++ b/pkg/cmd/pr/push/push.go @@ -53,7 +53,7 @@ func NewCmdPullRequestPush() (*cobra.Command, *Options) { Short: "Pushes the current git directory to the branch used to create the Pull Request", Long: cmdLong, Example: fmt.Sprintf(cmdExample, rootcmd.BinaryName), - Run: func(cmd *cobra.Command, args []string) { + Run: func(_ *cobra.Command, _ []string) { err := o.Run() helper.CheckErr(err) }, diff --git a/pkg/cmd/pr/variables/variables.go b/pkg/cmd/pr/variables/variables.go index f9fa1598a..dda01a76c 100644 --- a/pkg/cmd/pr/variables/variables.go +++ b/pkg/cmd/pr/variables/variables.go @@ -57,7 +57,7 @@ func NewCmdPullRequestVariables() (*cobra.Command, *Options) { Long: cmdLong, Aliases: []string{"var", "variable"}, Example: cmdExample, - Run: func(cmd *cobra.Command, args []string) { + Run: func(_ *cobra.Command, _ []string) { err := o.Run() helper.CheckErr(err) }, diff --git a/pkg/cmd/rename/rename.go b/pkg/cmd/rename/rename.go index 32b97353a..0582b41e5 100644 --- a/pkg/cmd/rename/rename.go +++ b/pkg/cmd/rename/rename.go @@ -42,7 +42,7 @@ func NewCmdRename() (*cobra.Command, *Options) { Short: "Renames yaml files to use canonical file names based on the resource name and kind", Long: splitLong, Example: fmt.Sprintf(splitExample, rootcmd.BinaryName), - Run: func(cmd *cobra.Command, args []string) { + Run: func(_ *cobra.Command, _ []string) { err := o.Run() helper.CheckErr(err) }, diff --git a/pkg/cmd/repository/add/add.go b/pkg/cmd/repository/add/add.go index 80a3e6b75..0c35f8f30 100644 --- a/pkg/cmd/repository/add/add.go +++ b/pkg/cmd/repository/add/add.go @@ -55,7 +55,7 @@ func NewCmdAddRepository() (*cobra.Command, *Options) { Short: "Add one or more git URLs to the source configuration", Long: cmdLong, Example: fmt.Sprintf(cmdExample, rootcmd.BinaryName, rootcmd.BinaryName), - Run: func(cmd *cobra.Command, args []string) { + Run: func(_ *cobra.Command, args []string) { o.Args = args err := o.Run() helper.CheckErr(err) diff --git a/pkg/cmd/repository/create/create.go b/pkg/cmd/repository/create/create.go index 405471e81..d7421089b 100644 --- a/pkg/cmd/repository/create/create.go +++ b/pkg/cmd/repository/create/create.go @@ -49,7 +49,7 @@ func NewCmdCreateRepository() (*cobra.Command, *Options) { Short: "Creates any missing SourceRepository resources", Long: cmdLong, Example: fmt.Sprintf(cmdExample, rootcmd.BinaryName, rootcmd.BinaryName), - Run: func(cmd *cobra.Command, args []string) { + Run: func(_ *cobra.Command, _ []string) { err := o.Run() helper.CheckErr(err) }, diff --git a/pkg/cmd/repository/deletecmd/delete.go b/pkg/cmd/repository/deletecmd/delete.go index 991c6ed0d..15512b447 100644 --- a/pkg/cmd/repository/deletecmd/delete.go +++ b/pkg/cmd/repository/deletecmd/delete.go @@ -54,7 +54,7 @@ func NewCmdDeleteRepository() (*cobra.Command, *Options) { Short: "Deletes a repository from the source configuration", Long: cmdLong, Example: cmdExample, - Run: func(cmd *cobra.Command, args []string) { + Run: func(_ *cobra.Command, _ []string) { err := o.Run() helper.CheckErr(err) }, diff --git a/pkg/cmd/repository/export/export.go b/pkg/cmd/repository/export/export.go index c0583795f..057426ea4 100644 --- a/pkg/cmd/repository/export/export.go +++ b/pkg/cmd/repository/export/export.go @@ -56,7 +56,7 @@ func NewCmdExportConfig() (*cobra.Command, *Options) { Short: "Exports the 'source-config.yaml' file from the kubernetes resources in the current cluster", Long: cmdLong, Example: fmt.Sprintf(cmdExample, rootcmd.BinaryName, rootcmd.BinaryName), - Run: func(cmd *cobra.Command, args []string) { + Run: func(_ *cobra.Command, _ []string) { err := o.Run() helper.CheckErr(err) }, diff --git a/pkg/cmd/repository/repository.go b/pkg/cmd/repository/repository.go index 4819b9918..089a5e807 100644 --- a/pkg/cmd/repository/repository.go +++ b/pkg/cmd/repository/repository.go @@ -17,7 +17,7 @@ func NewCmdRepository() *cobra.Command { Use: "repository", Short: "Commands for working with source repositories", Aliases: []string{"repo", "repos", "repositories"}, - Run: func(command *cobra.Command, args []string) { + Run: func(command *cobra.Command, _ []string) { err := command.Help() if err != nil { log.Logger().Errorf(err.Error()) diff --git a/pkg/cmd/repository/resolve/resolve.go b/pkg/cmd/repository/resolve/resolve.go index 1caad3cef..420a0e73a 100644 --- a/pkg/cmd/repository/resolve/resolve.go +++ b/pkg/cmd/repository/resolve/resolve.go @@ -52,7 +52,7 @@ func NewCmdResolveRepository() (*cobra.Command, *Options) { Short: "Resolves the git repository URL for the cluster/environment", Long: labelLong, Example: fmt.Sprintf(labelExample, rootcmd.BinaryName, rootcmd.BinaryName), - Run: func(cmd *cobra.Command, args []string) { + Run: func(_ *cobra.Command, args []string) { err := o.Run(args) helper.CheckErr(err) }, diff --git a/pkg/cmd/requirement/merge/merge.go b/pkg/cmd/requirement/merge/merge.go index f5a886647..ebe8c376f 100644 --- a/pkg/cmd/requirement/merge/merge.go +++ b/pkg/cmd/requirement/merge/merge.go @@ -68,7 +68,7 @@ func NewCmdRequirementsMerge() (*cobra.Command, *Options) { Short: "Merges values from the given file to the local jx-requirements.yml file", Long: cmdLong, Example: fmt.Sprintf(cmdExample, rootcmd.BinaryName, rootcmd.BinaryName), - RunE: func(cmd *cobra.Command, args []string) error { + RunE: func(_ *cobra.Command, _ []string) error { return o.Run() }, } diff --git a/pkg/cmd/requirement/publish/publish.go b/pkg/cmd/requirement/publish/publish.go index c7bc84969..9235f9492 100644 --- a/pkg/cmd/requirement/publish/publish.go +++ b/pkg/cmd/requirement/publish/publish.go @@ -50,7 +50,7 @@ func NewCmdRequirementsPublish() (*cobra.Command, *Options) { Short: "Publishes the current jx-requirements.yml to the dev Environment so it can be easily used in pipelines", Long: cmdLong, Example: fmt.Sprintf(cmdExample, rootcmd.BinaryName), - Run: func(cmd *cobra.Command, args []string) { + Run: func(_ *cobra.Command, _ []string) { err := o.Run() helper.CheckErr(err) }, diff --git a/pkg/cmd/requirement/requirement.go b/pkg/cmd/requirement/requirement.go index 31174e93f..5430e465d 100644 --- a/pkg/cmd/requirement/requirement.go +++ b/pkg/cmd/requirement/requirement.go @@ -21,7 +21,7 @@ func NewCmdRequirement() *cobra.Command { Use: "requirement", Short: "Commands for working with jx-requirements.yml", Aliases: []string{"req", "requirements"}, - Run: func(command *cobra.Command, args []string) { + Run: func(command *cobra.Command, _ []string) { err := command.Help() if err != nil { log.Logger().Errorf(err.Error()) diff --git a/pkg/cmd/requirement/resolve/resolve.go b/pkg/cmd/requirement/resolve/resolve.go index 7d3652e9d..44ae15c05 100644 --- a/pkg/cmd/requirement/resolve/resolve.go +++ b/pkg/cmd/requirement/resolve/resolve.go @@ -59,7 +59,7 @@ func NewCmdRequirementsResolve() (*cobra.Command, *Options) { Short: "Resolves any missing values in the jx-requirements.yml which can be detected", Long: cmdLong, Example: fmt.Sprintf(cmdExample, rootcmd.BinaryName), - RunE: func(cmd *cobra.Command, args []string) error { + RunE: func(_ *cobra.Command, _ []string) error { return o.Run() }, } diff --git a/pkg/cmd/root.go b/pkg/cmd/root.go index c4a97a3fa..9023d6aa3 100644 --- a/pkg/cmd/root.go +++ b/pkg/cmd/root.go @@ -45,7 +45,7 @@ func Main() *cobra.Command { cmd := &cobra.Command{ Use: rootcmd.TopLevelCommand, Short: "commands for working with GitOps based git repositories", - Run: func(cmd *cobra.Command, args []string) { + Run: func(cmd *cobra.Command, _ []string) { err := cmd.Help() if err != nil { log.Logger().Errorf(err.Error()) diff --git a/pkg/cmd/sa/sa.go b/pkg/cmd/sa/sa.go index 59fdc7184..01629cd9e 100644 --- a/pkg/cmd/sa/sa.go +++ b/pkg/cmd/sa/sa.go @@ -13,7 +13,7 @@ func NewCmdServiceAccount() *cobra.Command { Use: "sa", Short: "Commands for working with kubernetes ServiceAccount resources", Aliases: []string{"serviceaccount", "serviceaccounts"}, - Run: func(command *cobra.Command, args []string) { + Run: func(command *cobra.Command, _ []string) { err := command.Help() if err != nil { log.Logger().Errorf(err.Error()) diff --git a/pkg/cmd/sa/secret/secret.go b/pkg/cmd/sa/secret/secret.go index d67763328..3ce6a1726 100644 --- a/pkg/cmd/sa/secret/secret.go +++ b/pkg/cmd/sa/secret/secret.go @@ -45,7 +45,7 @@ func NewCmdServiceAccountSecrets() (*cobra.Command, *Options) { Short: "Adds one or more secrets to the given ServiceAccount files", Long: annotateLong, Example: fmt.Sprintf(annotateExample, rootcmd.BinaryName, rootcmd.BinaryName), - Run: func(cmd *cobra.Command, args []string) { + Run: func(_ *cobra.Command, _ []string) { err := o.Run() helper.CheckErr(err) }, diff --git a/pkg/cmd/scheduler/scheduler.go b/pkg/cmd/scheduler/scheduler.go index ac5f70ff6..6b7478e02 100644 --- a/pkg/cmd/scheduler/scheduler.go +++ b/pkg/cmd/scheduler/scheduler.go @@ -88,7 +88,7 @@ func NewCmdScheduler() (*cobra.Command, *Options) { Short: "Generates the Lighthouse configuration from the SourceRepository and Scheduler resources", Long: cmdLong, Example: fmt.Sprintf(cmdExample, rootcmd.BinaryName), - Run: func(cmd *cobra.Command, args []string) { + Run: func(_ *cobra.Command, _ []string) { err := o.Run() helper.CheckErr(err) }, @@ -233,7 +233,7 @@ func (o *Options) Run() error { resources = append(resources, devEnv) jxClient := fake.NewSimpleClientset(resources...) - loadSchedulers := func(jxClient versioned.Interface, ns string) (map[string]*schedulerapi.Scheduler, *v1.SourceRepositoryList, error) { + loadSchedulers := func(_ versioned.Interface, _ string) (map[string]*schedulerapi.Scheduler, *v1.SourceRepositoryList, error) { return schedulerMap, repoList, nil } diff --git a/pkg/cmd/split/split.go b/pkg/cmd/split/split.go index bcf3aaf0a..a83a612ff 100644 --- a/pkg/cmd/split/split.go +++ b/pkg/cmd/split/split.go @@ -46,7 +46,7 @@ func NewCmdSplit() (*cobra.Command, *Options) { Short: "Splits any YAML files which define multiple resources into separate files", Long: splitLong, Example: fmt.Sprintf(splitExample, rootcmd.BinaryName), - Run: func(cmd *cobra.Command, args []string) { + Run: func(_ *cobra.Command, _ []string) { err := o.Run() helper.CheckErr(err) }, diff --git a/pkg/cmd/upgrade/upgrade.go b/pkg/cmd/upgrade/upgrade.go index fc1897683..ee64cb89a 100644 --- a/pkg/cmd/upgrade/upgrade.go +++ b/pkg/cmd/upgrade/upgrade.go @@ -33,7 +33,7 @@ func NewCmdUpgrade() (*cobra.Command, *Options) { Use: "upgrade", Aliases: []string{"update"}, Short: "Upgrades the GitOps git repository with the latest configuration and versions the Version Stream", - Run: func(cmd *cobra.Command, args []string) { + Run: func(_ *cobra.Command, _ []string) { err := o.Run() helper.CheckErr(err) }, diff --git a/pkg/cmd/variables/variables.go b/pkg/cmd/variables/variables.go index caadc13f2..66b67b087 100644 --- a/pkg/cmd/variables/variables.go +++ b/pkg/cmd/variables/variables.go @@ -96,7 +96,7 @@ func NewCmdVariables() (*cobra.Command, *Options) { Short: "Lazily creates a .jx/variables.sh script with common pipeline environment variables", Long: cmdLong, Example: fmt.Sprintf(cmdExample, rootcmd.BinaryName), - Run: func(cmd *cobra.Command, args []string) { + Run: func(_ *cobra.Command, _ []string) { err := o.Run() helper.CheckErr(err) }, diff --git a/pkg/cmd/version/version.go b/pkg/cmd/version/version.go index 2840f6eec..90ecc71dd 100644 --- a/pkg/cmd/version/version.go +++ b/pkg/cmd/version/version.go @@ -37,7 +37,7 @@ func NewCmdVersion() (*cobra.Command, *Options) { cmd := &cobra.Command{ Use: "version", Short: "Displays the version of this command", - Run: func(cmd *cobra.Command, args []string) { + Run: func(_ *cobra.Command, _ []string) { err := o.Run() helper.CheckErr(err) }, diff --git a/pkg/cmd/versionstream/versionstream_test.go b/pkg/cmd/versionstream/versionstream_test.go index 78e12200f..cba388ebb 100644 --- a/pkg/cmd/versionstream/versionstream_test.go +++ b/pkg/cmd/versionstream/versionstream_test.go @@ -11,9 +11,6 @@ import ( "github.com/stretchr/testify/assert" ) -func TestRun(t *testing.T) { -} - func TestMoreThanOneFlagSet(t *testing.T) { o := Options{} assert.False(t, o.moreThanOneFlagSet()) diff --git a/pkg/cmd/webhook/delete/delete.go b/pkg/cmd/webhook/delete/delete.go index fc7e30685..daab4d956 100644 --- a/pkg/cmd/webhook/delete/delete.go +++ b/pkg/cmd/webhook/delete/delete.go @@ -69,7 +69,7 @@ func NewCmdWebHookDelete() (*cobra.Command, *Options) { Short: "deletes the webhooks for all the source repositories optionally filtering by owner and/or repository", Long: cmdLong, Example: fmt.Sprintf(cmdExample, rootcmd.BinaryName, rootcmd.BinaryName, rootcmd.BinaryName), - RunE: func(cmd *cobra.Command, args []string) error { + RunE: func(_ *cobra.Command, _ []string) error { return o.Run() }, } diff --git a/pkg/cmd/webhook/update/update.go b/pkg/cmd/webhook/update/update.go index f5a85db53..b8918401a 100644 --- a/pkg/cmd/webhook/update/update.go +++ b/pkg/cmd/webhook/update/update.go @@ -77,7 +77,7 @@ func NewCmdWebHookVerify() (*cobra.Command, *Options) { Short: "Updates the webhooks for all the source repositories optionally filtering by owner and/or repository", Long: cmdLong, Example: fmt.Sprintf(cmdExample, rootcmd.BinaryName, rootcmd.BinaryName, rootcmd.BinaryName), - RunE: func(cmd *cobra.Command, args []string) error { + RunE: func(_ *cobra.Command, _ []string) error { return o.Run() }, } diff --git a/pkg/cmd/webhook/webhook.go b/pkg/cmd/webhook/webhook.go index f69318001..5288fea11 100644 --- a/pkg/cmd/webhook/webhook.go +++ b/pkg/cmd/webhook/webhook.go @@ -19,7 +19,7 @@ func NewCmdWebhook() *cobra.Command { Use: "webhook", Short: "Commands for working with WebHooks on your source repositories", Aliases: []string{"webhooks", "hook", "hooks"}, - Run: func(command *cobra.Command, args []string) { + Run: func(command *cobra.Command, _ []string) { err := command.Help() if err != nil { log.Logger().Errorf(err.Error()) diff --git a/pkg/cmd/yset/yset.go b/pkg/cmd/yset/yset.go index 763d38a44..ffeec86bb 100644 --- a/pkg/cmd/yset/yset.go +++ b/pkg/cmd/yset/yset.go @@ -48,7 +48,7 @@ func NewCmdYSet() (*cobra.Command, *Options) { Short: "Modifies a value in a YAML file at a given path expression while preserving comments", Long: annotateLong, Example: fmt.Sprintf(annotateExample, rootcmd.BinaryName, rootcmd.BinaryName), - Run: func(cmd *cobra.Command, args []string) { + Run: func(_ *cobra.Command, args []string) { o.Args = args err := o.Run() helper.CheckErr(err) diff --git a/pkg/filters/string_filter.go b/pkg/filters/string_filter.go index a337b42b6..797146d8d 100644 --- a/pkg/filters/string_filter.go +++ b/pkg/filters/string_filter.go @@ -72,7 +72,7 @@ func (f *StringFilter) String() string { } // AddFlags adds cmd flags -func (f *StringFilter) AddFlags(cmd *cobra.Command, optionPrefix, message string) { +func (f *StringFilter) AddFlags(cmd *cobra.Command, optionPrefix, _ string) { cmd.Flags().StringVarP(&f.Prefix, optionPrefix+"-prefix", "", "", fmt.Sprintf("matches if %s has the given prefix", optionPrefix)) cmd.Flags().StringVarP(&f.Suffix, optionPrefix+"-suffix", "", "", fmt.Sprintf("matches if %s has the given suffix", optionPrefix)) cmd.Flags().StringVarP(&f.Contains, optionPrefix+"-contains", "", "", fmt.Sprintf("matches if %s contains the given text", optionPrefix)) diff --git a/pkg/tagging/base.go b/pkg/tagging/base.go index af7da5209..70bae78ac 100644 --- a/pkg/tagging/base.go +++ b/pkg/tagging/base.go @@ -49,7 +49,7 @@ func NewCmdUpdateTag(tagVerb, tagType string) (*cobra.Command, *Options) { Short: fmt.Sprintf("%ss all kubernetes resources in the given directory tree", caser.String(tagVerb)), Long: fmt.Sprintf(tagLong, caser.String(tagVerb)), Example: fmt.Sprintf(tagExample, tagVerb, rootcmd.BinaryName, tagType), - Run: func(cmd *cobra.Command, args []string) { + Run: func(_ *cobra.Command, args []string) { err := o.UpdateTagInYamlFiles(tagType+"s", args) helper.CheckErr(err) },