From 695359be228009b1044c26d7e38aab1b2a8ce216 Mon Sep 17 00:00:00 2001 From: Piyush Garg Date: Mon, 4 Mar 2024 14:39:32 +0530 Subject: [PATCH] Bump golangci-lint to v0.56.2 --- Makefile | 2 +- cmd/docs/md_docs.go | 2 +- pkg/bundle/builder_test.go | 2 +- pkg/bundle/parser_test.go | 2 +- pkg/cli/prerun/prerun.go | 2 +- pkg/cmd/bundle/list.go | 2 +- pkg/cmd/bundle/push.go | 2 +- pkg/cmd/clustertask/describe_test.go | 2 +- pkg/cmd/clustertask/list.go | 2 +- pkg/cmd/clustertriggerbinding/list.go | 2 +- pkg/cmd/customrun/list.go | 2 +- pkg/cmd/eventlistener/list.go | 2 +- pkg/cmd/pipeline/list.go | 2 +- pkg/cmd/pipeline/start.go | 8 ++++---- pkg/cmd/pipelinerun/cancel_test.go | 4 ++-- pkg/cmd/task/describe_test.go | 4 ++-- pkg/cmd/task/list.go | 2 +- pkg/cmd/task/start.go | 6 +++--- pkg/cmd/taskrun/cancel_test.go | 4 ++-- pkg/cmd/triggerbinding/list.go | 2 +- pkg/cmd/triggertemplate/list.go | 2 +- pkg/cmd/version/version.go | 4 ++-- pkg/cmd/version/version_test.go | 4 ++-- pkg/flags/flags.go | 2 +- pkg/options/describe.go | 2 +- pkg/options/logs.go | 2 +- pkg/pods/pod.go | 2 +- tekton/release-pipeline.yml | 2 +- test/framework/helper.go | 2 +- 29 files changed, 39 insertions(+), 39 deletions(-) diff --git a/Makefile b/Makefile index 8275512680..461f0e8535 100644 --- a/Makefile +++ b/Makefile @@ -11,7 +11,7 @@ M = $(shell printf "\033[34;1m🐱\033[0m") TIMEOUT_UNIT = 5m TIMEOUT_E2E = 20m -GOLANGCI_VERSION = v1.55.2 +GOLANGCI_VERSION = v1.56.2 YAML_FILES := $(shell find . -type f -regex ".*y[a]ml" -print) diff --git a/cmd/docs/md_docs.go b/cmd/docs/md_docs.go index 4100b5cb98..a65ee35c0e 100644 --- a/cmd/docs/md_docs.go +++ b/cmd/docs/md_docs.go @@ -127,7 +127,7 @@ func GenMarkdownCustom(cmd *cobra.Command, w io.Writer, linkHandler func(string) // help output will be in the file `cmd-sub-third.1`. func GenMarkdownTree(cmd *cobra.Command, dir string) error { identity := func(s string) string { return s } - emptyStr := func(s string) string { return "" } + emptyStr := func(_ string) string { return "" } return GenMarkdownTreeCustom(cmd, dir, emptyStr, identity) } diff --git a/pkg/bundle/builder_test.go b/pkg/bundle/builder_test.go index 17134c4ccb..01e3f5bf1b 100644 --- a/pkg/bundle/builder_test.go +++ b/pkg/bundle/builder_test.go @@ -45,7 +45,7 @@ spec: func init() { // shuffle the test tasks - sort.Slice(threeTasks, func(i, j int) bool { + sort.Slice(threeTasks, func(_, _ int) bool { return rand.Intn(2) == 0 }) } diff --git a/pkg/bundle/parser_test.go b/pkg/bundle/parser_test.go index 3b462b1b68..7b09864413 100644 --- a/pkg/bundle/parser_test.go +++ b/pkg/bundle/parser_test.go @@ -78,7 +78,7 @@ func TestDecodeFromRaw(t *testing.T) { } err := decodeObjects(strings.Join(rawObjects, YAMLSeparator), - func(gvr *schema.GroupVersionKind, element runtime.Object, raw []byte) error { + func(_ *schema.GroupVersionKind, element runtime.Object, _ []byte) error { test.Contains(t, tc.expectedElements, element) return nil }) diff --git a/pkg/cli/prerun/prerun.go b/pkg/cli/prerun/prerun.go index 6129efa1e4..1393f0c7a7 100644 --- a/pkg/cli/prerun/prerun.go +++ b/pkg/cli/prerun/prerun.go @@ -9,7 +9,7 @@ import ( ) func PersistentPreRunE(p cli.Params) func(*cobra.Command, []string) error { - return func(cmd *cobra.Command, args []string) error { + return func(cmd *cobra.Command, _ []string) error { if err := WarnExperimental(cmd); err != nil { return err } diff --git a/pkg/cmd/bundle/list.go b/pkg/cmd/bundle/list.go index b368b8ffb7..a2f67fd0d2 100644 --- a/pkg/cmd/bundle/list.go +++ b/pkg/cmd/bundle/list.go @@ -80,7 +80,7 @@ Caching: "kubernetes": "false", }, Args: cobra.RangeArgs(1, 3), - PreRunE: func(cmd *cobra.Command, args []string) error { + PreRunE: func(_ *cobra.Command, args []string) error { if len(args) < 1 { return errInvalidRef } diff --git a/pkg/cmd/bundle/push.go b/pkg/cmd/bundle/push.go index 03c1353c02..350e5ddcd8 100644 --- a/pkg/cmd/bundle/push.go +++ b/pkg/cmd/bundle/push.go @@ -79,7 +79,7 @@ Created time: "kubernetes": "false", }, Args: cobra.ExactArgs(1), - PreRunE: func(cmd *cobra.Command, args []string) error { + PreRunE: func(_ *cobra.Command, args []string) error { if len(args) != 1 { return errInvalidRef } diff --git a/pkg/cmd/clustertask/describe_test.go b/pkg/cmd/clustertask/describe_test.go index 9a721eeae2..05be2b7858 100644 --- a/pkg/cmd/clustertask/describe_test.go +++ b/pkg/cmd/clustertask/describe_test.go @@ -268,7 +268,7 @@ func Test_ClusterTaskDescribe(t *testing.T) { PrependReactors: []testDynamic.PrependOpt{{ Verb: "list", Resource: "taskruns", - Action: func(action k8stest.Action) (bool, runtime.Object, error) { + Action: func(_ k8stest.Action) (bool, runtime.Object, error) { return true, nil, errors.New("fake list taskrun error") }}}} dynamic2, err := tdc2.Client( diff --git a/pkg/cmd/clustertask/list.go b/pkg/cmd/clustertask/list.go index 80c98c4eb7..a95a01175e 100644 --- a/pkg/cmd/clustertask/list.go +++ b/pkg/cmd/clustertask/list.go @@ -49,7 +49,7 @@ func listCommand(p cli.Params) *cobra.Command { Annotations: map[string]string{ "commandType": "main", }, - RunE: func(cmd *cobra.Command, args []string) error { + RunE: func(cmd *cobra.Command, _ []string) error { output, err := cmd.LocalFlags().GetString("output") if err != nil { diff --git a/pkg/cmd/clustertriggerbinding/list.go b/pkg/cmd/clustertriggerbinding/list.go index 492d5bd9bb..e351e7cb07 100644 --- a/pkg/cmd/clustertriggerbinding/list.go +++ b/pkg/cmd/clustertriggerbinding/list.go @@ -58,7 +58,7 @@ or "commandType": "main", }, Example: eg, - RunE: func(cmd *cobra.Command, args []string) error { + RunE: func(cmd *cobra.Command, _ []string) error { cs, err := p.Clients() if err != nil { return err diff --git a/pkg/cmd/customrun/list.go b/pkg/cmd/customrun/list.go index 516ed00776..9112936859 100644 --- a/pkg/cmd/customrun/list.go +++ b/pkg/cmd/customrun/list.go @@ -75,7 +75,7 @@ func listCommand(p cli.Params) *cobra.Command { "commandType": "main", }, Example: eg, - RunE: func(cmd *cobra.Command, args []string) error { + RunE: func(cmd *cobra.Command, _ []string) error { if opts.Limit < 0 { return fmt.Errorf("limit was %d but must be a positive number", opts.Limit) } diff --git a/pkg/cmd/eventlistener/list.go b/pkg/cmd/eventlistener/list.go index b479acfe4e..03b9ce49e1 100644 --- a/pkg/cmd/eventlistener/list.go +++ b/pkg/cmd/eventlistener/list.go @@ -60,7 +60,7 @@ or "commandType": "main", }, Example: eg, - RunE: func(cmd *cobra.Command, args []string) error { + RunE: func(cmd *cobra.Command, _ []string) error { cs, err := p.Clients() if err != nil { return err diff --git a/pkg/cmd/pipeline/list.go b/pkg/cmd/pipeline/list.go index 36e5780523..af6cb0e6d2 100644 --- a/pkg/cmd/pipeline/list.go +++ b/pkg/cmd/pipeline/list.go @@ -75,7 +75,7 @@ func listCommand(p cli.Params) *cobra.Command { "commandType": "main", }, SilenceUsage: true, - RunE: func(cmd *cobra.Command, args []string) error { + RunE: func(cmd *cobra.Command, _ []string) error { cs, err := p.Clients() if err != nil { return err diff --git a/pkg/cmd/pipeline/start.go b/pkg/cmd/pipeline/start.go index 6c88d6a1ac..7c7a7797c6 100644 --- a/pkg/cmd/pipeline/start.go +++ b/pkg/cmd/pipeline/start.go @@ -133,7 +133,7 @@ For passing the workspaces via flags: SilenceUsage: true, ValidArgsFunction: formatted.ParentCompletion, - Args: func(cmd *cobra.Command, args []string) error { + Args: func(cmd *cobra.Command, _ []string) error { if err := flags.InitParams(p, cmd); err != nil { return err } @@ -176,7 +176,7 @@ For passing the workspaces via flags: c.Flags().BoolVarP(&opt.Last, "last", "L", false, "re-run the Pipeline using last PipelineRun values") c.Flags().StringVarP(&opt.UsePipelineRun, "use-pipelinerun", "", "", "use this pipelinerun values to re-run the pipeline. ") _ = c.RegisterFlagCompletionFunc("use-pipelinerun", - func(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) { + func(_ *cobra.Command, args []string, _ string) ([]string, cobra.ShellCompDirective) { return formatted.BaseCompletion("pipelinerun", args) }, ) @@ -198,14 +198,14 @@ For passing the workspaces via flags: c.Flags().StringVarP(&opt.ServiceAccountName, "serviceaccount", "s", "", "pass the serviceaccount name") _ = c.RegisterFlagCompletionFunc("serviceaccount", - func(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) { + func(_ *cobra.Command, args []string, _ string) ([]string, cobra.ShellCompDirective) { return formatted.BaseCompletion("serviceaccount", args) }, ) c.Flags().StringSliceVar(&opt.ServiceAccounts, "task-serviceaccount", []string{}, "pass the service account corresponding to the task") _ = c.RegisterFlagCompletionFunc("task-serviceaccount", - func(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) { + func(_ *cobra.Command, args []string, _ string) ([]string, cobra.ShellCompDirective) { return formatted.BaseCompletion("serviceaccount", args) }, ) diff --git a/pkg/cmd/pipelinerun/cancel_test.go b/pkg/cmd/pipelinerun/cancel_test.go index 3749262fb6..7205727ae0 100644 --- a/pkg/cmd/pipelinerun/cancel_test.go +++ b/pkg/cmd/pipelinerun/cancel_test.go @@ -239,7 +239,7 @@ func Test_cancel_pipelinerun_client_err_v1beta1(t *testing.T) { { Verb: "patch", Resource: "pipelineruns", - Action: func(action k8stest.Action) (bool, runtime.Object, error) { + Action: func(_ k8stest.Action) (bool, runtime.Object, error) { return true, nil, errors.New(errStr) }}}} dc, err := tdc.Client( @@ -306,7 +306,7 @@ func Test_cancel_pipelinerun_client_err(t *testing.T) { { Verb: "patch", Resource: "pipelineruns", - Action: func(action k8stest.Action) (bool, runtime.Object, error) { + Action: func(_ k8stest.Action) (bool, runtime.Object, error) { return true, nil, errors.New(errStr) }}}} dc, err := tdc.Client( diff --git a/pkg/cmd/task/describe_test.go b/pkg/cmd/task/describe_test.go index ab5bcbabb3..dd32b6d6a5 100644 --- a/pkg/cmd/task/describe_test.go +++ b/pkg/cmd/task/describe_test.go @@ -452,7 +452,7 @@ func TestTaskDescribe_TaskRunError_v1beta1(t *testing.T) { tdc := testDynamic.Options{ PrependReactors: []testDynamic.PrependOpt{ {Verb: "list", Resource: "taskruns", - Action: func(action k8stest.Action) (bool, runtime.Object, error) { + Action: func(_ k8stest.Action) (bool, runtime.Object, error) { return true, nil, errors.New("fake list taskrun error") }}}} dynamic, err := tdc.Client( @@ -509,7 +509,7 @@ func TestTaskDescribe_TaskRunError(t *testing.T) { tdc := testDynamic.Options{ PrependReactors: []testDynamic.PrependOpt{ {Verb: "list", Resource: "taskruns", - Action: func(action k8stest.Action) (bool, runtime.Object, error) { + Action: func(_ k8stest.Action) (bool, runtime.Object, error) { return true, nil, errors.New("fake list taskrun error") }}}} dynamic, err := tdc.Client( diff --git a/pkg/cmd/task/list.go b/pkg/cmd/task/list.go index aa306a2c80..cd60eb666b 100644 --- a/pkg/cmd/task/list.go +++ b/pkg/cmd/task/list.go @@ -64,7 +64,7 @@ func listCommand(p cli.Params) *cobra.Command { Annotations: map[string]string{ "commandType": "main", }, - RunE: func(cmd *cobra.Command, args []string) error { + RunE: func(cmd *cobra.Command, _ []string) error { cs, err := p.Clients() if err != nil { return err diff --git a/pkg/cmd/task/start.go b/pkg/cmd/task/start.go index cb444f6f1c..8b9e2d903e 100644 --- a/pkg/cmd/task/start.go +++ b/pkg/cmd/task/start.go @@ -220,14 +220,14 @@ For passing the workspaces via flags: c.Flags().StringArrayVarP(&opt.Params, "param", "p", []string{}, "pass the param as key=value for string type, or key=value1,value2,... for array type, or key=\"key1:value1, key2:value2\" for object type") c.Flags().StringVarP(&opt.ServiceAccountName, "serviceaccount", "s", "", "pass the serviceaccount name") _ = c.RegisterFlagCompletionFunc("serviceaccount", - func(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) { + func(_ *cobra.Command, args []string, _ string) ([]string, cobra.ShellCompDirective) { return formatted.BaseCompletion("serviceaccount", args) }, ) c.Flags().BoolVarP(&opt.Last, "last", "L", false, "re-run the Task using last TaskRun values") c.Flags().StringVarP(&opt.UseTaskRun, "use-taskrun", "", "", "specify a TaskRun name to use its values to re-run the TaskRun") _ = c.RegisterFlagCompletionFunc("use-taskrun", - func(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) { + func(_ *cobra.Command, args []string, _ string) ([]string, cobra.ShellCompDirective) { return formatted.BaseCompletion("taskrun", args) }, ) @@ -334,7 +334,7 @@ func startTask(opt startOptions, args []string) error { if err != nil { return err } - err = bundle.Get(img, "task", args[0], func(_, _, _ string, element runtime.Object, b []byte) { + err = bundle.Get(img, "task", args[0], func(_, _, _ string, _ runtime.Object, b []byte) { task, intErr := parseTask(b) if intErr != nil { err = intErr diff --git a/pkg/cmd/taskrun/cancel_test.go b/pkg/cmd/taskrun/cancel_test.go index 9c6d39a357..77d251f71a 100644 --- a/pkg/cmd/taskrun/cancel_test.go +++ b/pkg/cmd/taskrun/cancel_test.go @@ -185,7 +185,7 @@ func TestTaskRunCancel_v1beta1(t *testing.T) { tdc2 := testDynamic.Options{PrependReactors: []testDynamic.PrependOpt{ {Verb: "patch", Resource: "taskruns", - Action: func(action k8stest.Action) (bool, runtime.Object, error) { + Action: func(_ k8stest.Action) (bool, runtime.Object, error) { return true, nil, errors.New("test error") }}}} dc2, err := tdc2.Client( @@ -449,7 +449,7 @@ func TestTaskRunCancel(t *testing.T) { tdc2 := testDynamic.Options{PrependReactors: []testDynamic.PrependOpt{ {Verb: "patch", Resource: "taskruns", - Action: func(action k8stest.Action) (bool, runtime.Object, error) { + Action: func(_ k8stest.Action) (bool, runtime.Object, error) { return true, nil, errors.New("test error") }}}} dc2, err := tdc2.Client( diff --git a/pkg/cmd/triggerbinding/list.go b/pkg/cmd/triggerbinding/list.go index dcf99f5429..c5cbe27def 100644 --- a/pkg/cmd/triggerbinding/list.go +++ b/pkg/cmd/triggerbinding/list.go @@ -59,7 +59,7 @@ or "commandType": "main", }, Example: eg, - RunE: func(cmd *cobra.Command, args []string) error { + RunE: func(cmd *cobra.Command, _ []string) error { cs, err := p.Clients() if err != nil { return err diff --git a/pkg/cmd/triggertemplate/list.go b/pkg/cmd/triggertemplate/list.go index a0c46edfc7..89d4f0234c 100644 --- a/pkg/cmd/triggertemplate/list.go +++ b/pkg/cmd/triggertemplate/list.go @@ -58,7 +58,7 @@ or "commandType": "main", }, Example: eg, - RunE: func(cmd *cobra.Command, args []string) error { + RunE: func(cmd *cobra.Command, _ []string) error { cs, err := p.Clients() if err != nil { return err diff --git a/pkg/cmd/version/version.go b/pkg/cmd/version/version.go index dece11f29b..6ae152f5a1 100644 --- a/pkg/cmd/version/version.go +++ b/pkg/cmd/version/version.go @@ -57,7 +57,7 @@ func Command(p cli.Params) *cobra.Command { Annotations: map[string]string{ "commandType": "utility", }, - PersistentPreRunE: func(cmd *cobra.Command, args []string) error { + PersistentPreRunE: func(cmd *cobra.Command, _ []string) error { if err := flags.InitParams(p, cmd); err != nil { // this check allows tkn version to be run without // a kubeconfig so users can verify the tkn version @@ -69,7 +69,7 @@ func Command(p cli.Params) *cobra.Command { } return nil }, - RunE: func(cmd *cobra.Command, args []string) error { + RunE: func(cmd *cobra.Command, _ []string) error { cs, err := p.Clients() if err == nil { switch component { diff --git a/pkg/cmd/version/version_test.go b/pkg/cmd/version/version_test.go index b8844fde30..c68e2c3e72 100644 --- a/pkg/cmd/version/version_test.go +++ b/pkg/cmd/version/version_test.go @@ -61,7 +61,7 @@ func TestVersionGood(t *testing.T) { for _, s := range scenarios { t.Run(s.name, func(t *testing.T) { clientVersion = s.clientVersion - h := http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + h := http.HandlerFunc(func(w http.ResponseWriter, _ *http.Request) { okResponse, _ := json.Marshal(GHVersion{ TagName: s.serverVersion, HTMLURL: "https://github.com/tektoncd/cli/releases/tag/" + s.serverVersion, @@ -198,7 +198,7 @@ func TestVersionBad(t *testing.T) { for _, s := range scenarios { t.Run(s.name, func(t *testing.T) { clientVersion = s.clientVersion - h := http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + h := http.HandlerFunc(func(w http.ResponseWriter, _ *http.Request) { okResponse, _ := json.Marshal(GHVersion{ TagName: s.serverVersion, HTMLURL: "https://github.com/tektoncd/cli/releases/tag/" + s.serverVersion, diff --git a/pkg/flags/flags.go b/pkg/flags/flags.go index b631c59155..b939b4a95c 100644 --- a/pkg/flags/flags.go +++ b/pkg/flags/flags.go @@ -52,7 +52,7 @@ func AddTektonOptions(cmd *cobra.Command) { namespace, "n", "", "namespace to use (default: from $KUBECONFIG)") _ = cmd.RegisterFlagCompletionFunc(namespace, - func(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) { + func(_ *cobra.Command, args []string, _ string) ([]string, cobra.ShellCompDirective) { return formatted.BaseCompletion("namespace", args) }, ) diff --git a/pkg/options/describe.go b/pkg/options/describe.go index d7be445adf..f6f75c2675 100644 --- a/pkg/options/describe.go +++ b/pkg/options/describe.go @@ -120,7 +120,7 @@ func (opts *DescribeOptions) FuzzyAsk(resource string, options []string) error { func(i int) string { return strings.Fields(options[i])[0] }, - fuzzyfinder.WithPreviewWindow(func(i, w, h int) string { + fuzzyfinder.WithPreviewWindow(func(i, _, _ int) string { if i == -1 { return "" } diff --git a/pkg/options/logs.go b/pkg/options/logs.go index 8f821e22aa..1dce5474f6 100644 --- a/pkg/options/logs.go +++ b/pkg/options/logs.go @@ -120,7 +120,7 @@ func (opts *LogOptions) FuzzyAsk(resource string, options []string) error { func(i int) string { return strings.Fields(options[i])[0] }, - fuzzyfinder.WithPreviewWindow(func(i, w, h int) string { + fuzzyfinder.WithPreviewWindow(func(i, _, _ int) string { if i == -1 { return "" } diff --git a/pkg/pods/pod.go b/pkg/pods/pod.go index 574d82ca21..b73a3307d4 100644 --- a/pkg/pods/pod.go +++ b/pkg/pods/pod.go @@ -119,7 +119,7 @@ func (p *Pod) watcher(stopC <-chan struct{}, eventC chan<- interface{}, mu *sync eventC <- obj } }, - UpdateFunc: func(oldObj, newObj interface{}) { + UpdateFunc: func(_, newObj interface{}) { mu.Lock() defer mu.Unlock() select { diff --git a/tekton/release-pipeline.yml b/tekton/release-pipeline.yml index 8a09f8d0cc..9a4b2c96a3 100644 --- a/tekton/release-pipeline.yml +++ b/tekton/release-pipeline.yml @@ -54,7 +54,7 @@ spec: - name: flags value: "-v --timeout 20m" - name: version - value: v1.55.2 + value: v1.56.2 workspaces: - name: source workspace: shared-workspace diff --git a/test/framework/helper.go b/test/framework/helper.go index 73ecfb48a1..e32d71bea5 100644 --- a/test/framework/helper.go +++ b/test/framework/helper.go @@ -176,7 +176,7 @@ func VerifyServiceAccountExistenceForSecrets(namespace string, kubeClient kubern func getCRDYaml(cs *Clients, ns string) ([]byte, error) { var output []byte - printOrAdd := func(kind, name string, i interface{}) { + printOrAdd := func(_, _ string, i interface{}) { bs, err := yaml.Marshal(i) if err != nil { return