Skip to content

Commit 9825206

Browse files
committed
Fix golangci-lint latest
Mostly unused variables of revive linter errors Signed-off-by: Chmouel Boudjnah <[email protected]>
1 parent 2138a48 commit 9825206

File tree

40 files changed

+97
-111
lines changed

40 files changed

+97
-111
lines changed

pkg/cli/cli.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ import (
55

66
"github.com/AlecAivazis/survey/v2"
77
"github.com/AlecAivazis/survey/v2/terminal"
8-
"github.com/spf13/cobra"
98
)
109

1110
type PacCliOpts struct {
@@ -26,7 +25,7 @@ func NewAskopts(opt *survey.AskOptions) error {
2625
return nil
2726
}
2827

29-
func NewCliOptions(cmd *cobra.Command) *PacCliOpts {
28+
func NewCliOptions() *PacCliOpts {
3029
return &PacCliOpts{
3130
AskOpts: NewAskopts,
3231
}

pkg/cli/webhook/gitlab_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -84,8 +84,8 @@ func TestAskGLWebhookConfig(t *testing.T) {
8484
}
8585

8686
func TestGLCreate(t *testing.T) {
87-
ctx, _ := rtesting.SetupFakeContext(t)
88-
fakeclient, mux, teardown := thelp.Setup(ctx, t)
87+
_, _ = rtesting.SetupFakeContext(t)
88+
fakeclient, mux, teardown := thelp.Setup(t)
8989
defer teardown()
9090
//nolint
9191
io, _, _, _ := cli.IOTest()

pkg/cmd/tknpac/bootstrap/bootstrap.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ func Command(run *params.Run, ioStreams *cli.IOStreams) *cobra.Command {
138138
Short: "Bootstrap Pipelines as Code.",
139139
RunE: func(cmd *cobra.Command, args []string) error {
140140
ctx := context.Background()
141-
opts.cliOpts = cli.NewCliOptions(cmd)
141+
opts.cliOpts = cli.NewCliOptions()
142142
opts.ioStreams.SetColorEnabled(!opts.cliOpts.NoColoring)
143143
if err := run.Clients.NewClients(ctx, &run.Info); err != nil {
144144
return err
@@ -191,7 +191,7 @@ func GithubApp(run *params.Run, ioStreams *cli.IOStreams) *cobra.Command {
191191
Short: "Create PAC GitHub Application",
192192
RunE: func(cmd *cobra.Command, args []string) error {
193193
ctx := context.Background()
194-
opts.cliOpts = cli.NewCliOptions(cmd)
194+
opts.cliOpts = cli.NewCliOptions()
195195
opts.ioStreams.SetColorEnabled(!opts.cliOpts.NoColoring)
196196
if err := run.Clients.NewClients(ctx, &run.Info); err != nil {
197197
return err

pkg/cmd/tknpac/completion/completion.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,6 @@ func BaseCompletion(target string, args []string) ([]string, cobra.ShellCompDire
2626
}
2727

2828
// ParentCompletion do completion of command to the Parent
29-
func ParentCompletion(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) {
29+
func ParentCompletion(cmd *cobra.Command, args []string, _ string) ([]string, cobra.ShellCompDirective) {
3030
return BaseCompletion(cmd.Parent().Name(), args)
3131
}

pkg/cmd/tknpac/create/repository.go

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ func repositoryCommand(run *params.Run, ioStreams *cli.IOStreams) *cobra.Command
5454
RunE: func(cmd *cobra.Command, args []string) error {
5555
ctx := context.Background()
5656
createOpts.IoStreams = ioStreams
57-
createOpts.cliOpts = cli.NewCliOptions(cmd)
57+
createOpts.cliOpts = cli.NewCliOptions()
5858
createOpts.IoStreams.SetColorEnabled(!createOpts.cliOpts.NoColoring)
5959

6060
cwd, err := os.Getwd()
@@ -83,10 +83,7 @@ func repositoryCommand(run *params.Run, ioStreams *cli.IOStreams) *cobra.Command
8383

8484
if pacInfo.IsGithubAppInstalled(ctx, run, installationNS) {
8585
if strings.Contains(createOpts.Event.URL, "github") {
86-
if err := createOpts.generateTemplate(nil); err != nil {
87-
return err
88-
}
89-
return nil
86+
return createOpts.generateTemplate(nil)
9087
}
9188
}
9289

@@ -108,10 +105,7 @@ func repositoryCommand(run *params.Run, ioStreams *cli.IOStreams) *cobra.Command
108105
if err := config.Install(ctx, createOpts.Provider); err != nil {
109106
return err
110107
}
111-
if err := createOpts.generateTemplate(nil); err != nil {
112-
return err
113-
}
114-
return nil
108+
return createOpts.generateTemplate(nil)
115109
},
116110
Annotations: map[string]string{
117111
"commandType": "main",

pkg/cmd/tknpac/deleterepo/delete.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ func repositoryCommand(run *params.Run, ioStreams *cli.IOStreams) *cobra.Command
3434
},
3535
RunE: func(cmd *cobra.Command, args []string) error {
3636
var err error
37-
opts := cli.NewCliOptions(cmd)
37+
opts := cli.NewCliOptions()
3838
opts.Namespace, err = cmd.Flags().GetString(namespaceFlag)
3939
if err != nil {
4040
return err

pkg/cmd/tknpac/describe/describe.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,9 +63,9 @@ type describeOpts struct {
6363
ShowEvents bool
6464
}
6565

66-
func newDescribeOptions(cmd *cobra.Command) *describeOpts {
66+
func newDescribeOptions(_ *cobra.Command) *describeOpts {
6767
return &describeOpts{
68-
PacCliOpts: *cli.NewCliOptions(cmd),
68+
PacCliOpts: *cli.NewCliOptions(),
6969
}
7070
}
7171

pkg/cmd/tknpac/generate/generate.go

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ func Command(run *params.Run, ioStreams *cli.IOStreams) *cobra.Command {
5959
Short: "Generate PipelineRun",
6060
RunE: func(cmd *cobra.Command, args []string) error {
6161
ctx := context.Background()
62-
gopt.CLIOpts = cli.NewCliOptions(cmd)
62+
gopt.CLIOpts = cli.NewCliOptions()
6363
gopt.IOStreams.SetColorEnabled(!gopt.CLIOpts.NoColoring)
6464

6565
if !gopt.generateWithClusterTask {
@@ -113,10 +113,7 @@ func Generate(o *Opts, recreateTemplate bool) error {
113113
return err
114114
}
115115

116-
if err := o.samplePipeline(recreateTemplate); err != nil {
117-
return err
118-
}
119-
return nil
116+
return o.samplePipeline(recreateTemplate)
120117
}
121118

122119
func (o *Opts) targetEvent() error {

pkg/cmd/tknpac/list/list.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ func Root(run *params.Run, ioStreams *cli.IOStreams) *cobra.Command {
4444
},
4545
RunE: func(cmd *cobra.Command, args []string) error {
4646
var err error
47-
opts := cli.NewCliOptions(cmd)
47+
opts := cli.NewCliOptions()
4848
opts.AllNameSpaces, err = cmd.Flags().GetBool(allNamespacesFlag)
4949
if err != nil {
5050
return err

pkg/cmd/tknpac/logs/logs.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ func Command(run *params.Run, ioStreams *cli.IOStreams) *cobra.Command {
6969
RunE: func(cmd *cobra.Command, args []string) error {
7070
var err error
7171
var repoName string
72-
opts := cli.NewCliOptions(cmd)
72+
opts := cli.NewCliOptions()
7373

7474
opts.Namespace, err = cmd.Flags().GetString(namespaceFlag)
7575
if err != nil {

0 commit comments

Comments
 (0)