Skip to content

Commit

Permalink
Bump golangci-lint to v0.56.2
Browse files Browse the repository at this point in the history
  • Loading branch information
piyush-garg authored and tekton-robot committed Mar 5, 2024
1 parent e72a943 commit 10ff5ff
Show file tree
Hide file tree
Showing 29 changed files with 39 additions and 39 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down
2 changes: 1 addition & 1 deletion cmd/docs/md_docs.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}

Expand Down
2 changes: 1 addition & 1 deletion pkg/bundle/builder_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
})
}
Expand Down
2 changes: 1 addition & 1 deletion pkg/bundle/parser_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
})
Expand Down
2 changes: 1 addition & 1 deletion pkg/cli/prerun/prerun.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down
2 changes: 1 addition & 1 deletion pkg/cmd/bundle/list.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down
2 changes: 1 addition & 1 deletion pkg/cmd/bundle/push.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down
2 changes: 1 addition & 1 deletion pkg/cmd/clustertask/describe_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
2 changes: 1 addition & 1 deletion pkg/cmd/clustertask/list.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
2 changes: 1 addition & 1 deletion pkg/cmd/clustertriggerbinding/list.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion pkg/cmd/customrun/list.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
Expand Down
2 changes: 1 addition & 1 deletion pkg/cmd/eventlistener/list.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion pkg/cmd/pipeline/list.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
8 changes: 4 additions & 4 deletions pkg/cmd/pipeline/start.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down Expand Up @@ -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)
},
)
Expand All @@ -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)
},
)
Expand Down
4 changes: 2 additions & 2 deletions pkg/cmd/pipelinerun/cancel_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down Expand Up @@ -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(
Expand Down
4 changes: 2 additions & 2 deletions pkg/cmd/task/describe_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down Expand Up @@ -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(
Expand Down
2 changes: 1 addition & 1 deletion pkg/cmd/task/list.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 3 additions & 3 deletions pkg/cmd/task/start.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
},
)
Expand Down Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions pkg/cmd/taskrun/cancel_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down Expand Up @@ -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(
Expand Down
2 changes: 1 addition & 1 deletion pkg/cmd/triggerbinding/list.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion pkg/cmd/triggertemplate/list.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions pkg/cmd/version/version.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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 {
Expand Down
4 changes: 2 additions & 2 deletions pkg/cmd/version/version_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion pkg/flags/flags.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
},
)
Expand Down
2 changes: 1 addition & 1 deletion pkg/options/describe.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 ""
}
Expand Down
2 changes: 1 addition & 1 deletion pkg/options/logs.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 ""
}
Expand Down
2 changes: 1 addition & 1 deletion pkg/pods/pod.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
2 changes: 1 addition & 1 deletion tekton/release-pipeline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion test/framework/helper.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 10ff5ff

Please sign in to comment.