Skip to content

Commit dafcf0d

Browse files
committed
fix(workflow-cli): lint error
1 parent 2b8a596 commit dafcf0d

9 files changed

Lines changed: 45 additions & 48 deletions

File tree

internal/commands/autoscale.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ func (d *DryccCmd) AutoscaleList(appID string) error {
3939
}
4040

4141
// AutoscaleSet sets autoscale options for the app.
42-
func (d *DryccCmd) AutoscaleSet(appID string, ptype string, min int, max int, CPUPercent int) error {
42+
func (d *DryccCmd) AutoscaleSet(appID string, ptype string, minCPU int, maxCPU int, CPUPercent int) error {
4343
appID, s, err := utils.LoadAppSettings(d.ConfigFile, appID)
4444

4545
if err != nil {
@@ -51,8 +51,8 @@ func (d *DryccCmd) AutoscaleSet(appID string, ptype string, min int, max int, CP
5151
quit := progress(d.WOut)
5252
data := map[string]*api.Autoscale{
5353
ptype: {
54-
Min: min,
55-
Max: max,
54+
Min: minCPU,
55+
Max: maxCPU,
5656
CPUPercent: CPUPercent,
5757
},
5858
}

internal/completion/completion.go

Lines changed: 18 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -83,10 +83,9 @@ func (c *CertDomainTachCompletion) CompletionFunc(cmd *cobra.Command, args []str
8383
if len(args) == 0 {
8484
certCompletion := CertCompletion{AppID: c.AppID, ConfigFile: c.ConfigFile}
8585
return certCompletion.CompletionFunc(cmd, args, toComplete)
86-
} else {
87-
domainCompletion := DomainCompletion{AppID: c.AppID, ArgsLen: 1, ConfigFile: c.ConfigFile}
88-
return domainCompletion.CompletionFunc(cmd, args, toComplete)
8986
}
87+
domainCompletion := DomainCompletion{AppID: c.AppID, ArgsLen: 1, ConfigFile: c.ConfigFile}
88+
return domainCompletion.CompletionFunc(cmd, args, toComplete)
9089
}
9190

9291
type ConfigPtsGroupArgsCompletion struct {
@@ -98,20 +97,19 @@ func (c *ConfigPtsGroupArgsCompletion) CompletionFunc(cmd *cobra.Command, args [
9897
if len(args) == 0 {
9998
ptsCompletion := PtsCompletion{AppID: c.AppID, ConfigFile: c.ConfigFile}
10099
return ptsCompletion.CompletionFunc(cmd, args, toComplete)
101-
} else {
102-
groups := args[1:]
103-
if appID, s, err := utils.LoadAppSettings(*c.ConfigFile, *c.AppID); err == nil {
104-
if config, err := config.List(s.Client, appID, -1); err == nil {
105-
var results []string
106-
for _, value := range config.Values {
107-
if value.Group != "" && strings.HasPrefix(value.Group, toComplete) {
108-
if !slices.Contains(groups, value.Group) && !slices.Contains(results, value.Group) {
109-
results = append(results, value.Group)
110-
}
100+
}
101+
groups := args[1:]
102+
if appID, s, err := utils.LoadAppSettings(*c.ConfigFile, *c.AppID); err == nil {
103+
if config, err := config.List(s.Client, appID, -1); err == nil {
104+
var results []string
105+
for _, value := range config.Values {
106+
if value.Group != "" && strings.HasPrefix(value.Group, toComplete) {
107+
if !slices.Contains(groups, value.Group) && !slices.Contains(results, value.Group) {
108+
results = append(results, value.Group)
111109
}
112110
}
113-
return results, cobra.ShellCompDirectiveNoFileComp
114111
}
112+
return results, cobra.ShellCompDirectiveNoFileComp
115113
}
116114
}
117115
return nil, cobra.ShellCompDirectiveNoFileComp
@@ -123,7 +121,7 @@ type ConfigGroupCompletion struct {
123121
ArgsLen int
124122
}
125123

126-
func (c *ConfigGroupCompletion) CompletionFunc(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) {
124+
func (c *ConfigGroupCompletion) CompletionFunc(_ *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) {
127125

128126
if appID, s, err := utils.LoadAppSettings(*c.ConfigFile, *c.AppID); err == nil && (c.ArgsLen < 0 || len(args) == c.ArgsLen) {
129127
if config, err := config.List(s.Client, appID, -1); err == nil {
@@ -253,10 +251,9 @@ func (c *HealthChecksCompletion) CompletionFunc(cmd *cobra.Command, args []strin
253251
if len(args) == 0 {
254252
healthTypeCompletion := HealthTypeCompletion{ArgsLen: 0, ConfigFile: c.ConfigFile}
255253
return healthTypeCompletion.CompletionFunc(cmd, args, toComplete)
256-
} else {
257-
probeTypeCompletion := ProbeTypeCompletion{ArgsLen: 1, ConfigFile: c.ConfigFile}
258-
return probeTypeCompletion.CompletionFunc(cmd, args, toComplete)
259254
}
255+
probeTypeCompletion := ProbeTypeCompletion{ArgsLen: 1, ConfigFile: c.ConfigFile}
256+
return probeTypeCompletion.CompletionFunc(cmd, args, toComplete)
260257
}
261258

262259
type ServiceProtocolCompletion struct {
@@ -555,7 +552,7 @@ type ResourcePlanCompletion struct {
555552
ConfigFile *string
556553
}
557554

558-
func (c *ResourcePlanCompletion) CompletionFunc(_ *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) {
555+
func (c *ResourcePlanCompletion) CompletionFunc(_ *cobra.Command, args []string, _ string) ([]string, cobra.ShellCompDirective) {
559556
if s, err := settings.Load(*c.ConfigFile); err == nil && (c.ArgsLen < 0 || len(args) == c.ArgsLen) {
560557
var results []string
561558
if services, _, err := resources.Plans(s.Client, c.Service, -1); err == nil {
@@ -735,12 +732,12 @@ func (c *TagCompletion) CompletionFunc(_ *cobra.Command, args []string, toComple
735732
return nil, cobra.ShellCompDirectiveNoFileComp
736733
}
737734

738-
type TlsActionCompletion struct {
735+
type TLSActionCompletion struct {
739736
ArgsLen int
740737
ConfigFile *string
741738
}
742739

743-
func (c *TlsActionCompletion) CompletionFunc(_ *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) {
740+
func (c *TLSActionCompletion) CompletionFunc(_ *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) {
744741
actions := []string{"enable", "disable"}
745742
if c.ArgsLen < 0 || len(args) == c.ArgsLen {
746743

internal/parser/autoscale.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,8 +74,8 @@ func autoscaleSetCommand(cmdr *commands.DryccCmd) *cobra.Command {
7474
cmd.Flags().IntVarP(&flags.cpuPercent, "cpu-percent", "", 0, i18n.T("Target CPU utilization percentage"))
7575
cmd.Flags().SortFlags = false
7676

77-
must_flags := []string{"min", "max", "cpu-percent"}
78-
for _, must_flag := range must_flags {
77+
mustFlags := []string{"min", "max", "cpu-percent"}
78+
for _, must_flag := range mustFlags {
7979
cmd.MarkFlagRequired(must_flag)
8080
}
8181

internal/parser/gateways.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ func NewGatewaysCommand(cmdr *commands.DryccCmd) *cobra.Command {
1212
cmd := &cobra.Command{
1313
Use: "gateways",
1414
Short: i18n.T("Manage gateways for your applications"),
15-
RunE: func(cmd *cobra.Command, args []string) error {
15+
RunE: func(_ *cobra.Command, args []string) error {
1616
results, _ := commands.ResponseLimit(limit)
1717
return cmdr.GatewaysList(app, results)
1818
},
@@ -67,8 +67,8 @@ func gatewaysAdd(cmdr *commands.DryccCmd) *cobra.Command {
6767
cmd.Flags().IntVar(&flags.port, "port", 0, i18n.T("Port is the network port, the listener expects to receive"))
6868
cmd.Flags().StringVarP(&flags.protocol, "protocol", "", "", i18n.T("Protocol specifies the network protocol this listener expects to receive. Supports TCP, UDP, TLS, HTTP, and HTTPS"))
6969

70-
must_flags := []string{"port", "protocol"}
71-
for _, must_flag := range must_flags {
70+
mustFlags := []string{"port", "protocol"}
71+
for _, must_flag := range mustFlags {
7272
cmd.MarkFlagRequired(must_flag)
7373
}
7474

@@ -100,8 +100,8 @@ func gatewaysRemove(cmdr *commands.DryccCmd) *cobra.Command {
100100
cmd.Flags().IntVar(&flags.port, "port", 0, i18n.T("Port is the network port, the listener received"))
101101
cmd.Flags().StringVarP(&flags.protocol, "protocol", "", "", i18n.T("Protocol specifies the network protocol this listener received"))
102102

103-
must_flags := []string{"port", "protocol"}
104-
for _, must_flag := range must_flags {
103+
mustFlags := []string{"port", "protocol"}
104+
for _, must_flag := range mustFlags {
105105
cmd.MarkFlagRequired(must_flag)
106106
}
107107

internal/parser/routes.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -187,8 +187,8 @@ func routesAttachCommand(cmdr *commands.DryccCmd) *cobra.Command {
187187
cmd.Flags().StringVar(&flags.gateway, "gateway", "", i18n.T("The unique name of the gaetway"))
188188
cmd.Flags().IntVarP(&flags.port, "port", "", 0, i18n.T("Port is the network port, the gateway listener expects to receive"))
189189

190-
must_flags := []string{"gateway", "port"}
191-
for _, must_flag := range must_flags {
190+
mustFlags := []string{"gateway", "port"}
191+
for _, must_flag := range mustFlags {
192192
cmd.MarkFlagRequired(must_flag)
193193
}
194194

@@ -223,8 +223,8 @@ func routesDetachCommand(cmdr *commands.DryccCmd) *cobra.Command {
223223
cmd.Flags().StringVar(&flags.gateway, "gateway", "", i18n.T("The unique name of the gaetway"))
224224
cmd.Flags().IntVarP(&flags.port, "port", "", 0, i18n.T("Port is the network port, the gateway listener expects to receive"))
225225

226-
must_flags := []string{"port", "protocol"}
227-
for _, must_flag := range must_flags {
226+
mustFlags := []string{"port", "protocol"}
227+
for _, must_flag := range mustFlags {
228228
cmd.MarkFlagRequired(must_flag)
229229
}
230230

internal/parser/timeouts.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ func NewTimeoutsCommand(cmdr *commands.DryccCmd) *cobra.Command {
1313
cmd := &cobra.Command{
1414
Use: "timeouts",
1515
Short: i18n.T("Manage pods termination grace period"),
16-
RunE: func(cmd *cobra.Command, args []string) error {
16+
RunE: func(_ *cobra.Command, args []string) error {
1717
return cmdr.TimeoutsList(app, version)
1818
},
1919
}

internal/parser/tls.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ func tlsInfoCommand(cmdr *commands.DryccCmd) *cobra.Command {
4646
}
4747

4848
func tlsForceCommand(cmdr *commands.DryccCmd) *cobra.Command {
49-
tlsActionCompletion := completion.TlsActionCompletion{ArgsLen: -1, ConfigFile: &cmdr.ConfigFile}
49+
TLSActionCompletion := completion.TLSActionCompletion{ArgsLen: -1, ConfigFile: &cmdr.ConfigFile}
5050
cmd := &cobra.Command{
5151
Use: "force <action>",
5252
Example: template.CustomExample(
@@ -58,7 +58,7 @@ func tlsForceCommand(cmdr *commands.DryccCmd) *cobra.Command {
5858
Args: cobra.ExactArgs(1),
5959
ValidArgs: []string{"enable", "disable"},
6060
Short: i18n.T("Force TLS settings to HTTPS-only redirection"),
61-
ValidArgsFunction: tlsActionCompletion.CompletionFunc,
61+
ValidArgsFunction: TLSActionCompletion.CompletionFunc,
6262
RunE: func(cmd *cobra.Command, args []string) error {
6363
action := args[0]
6464
if action == "enable" {
@@ -74,7 +74,7 @@ func tlsForceCommand(cmdr *commands.DryccCmd) *cobra.Command {
7474
}
7575

7676
func tlsAutoCommand(cmdr *commands.DryccCmd) *cobra.Command {
77-
tlsActionCompletion := completion.TlsActionCompletion{ArgsLen: -1, ConfigFile: &cmdr.ConfigFile}
77+
TLSActionCompletion := completion.TLSActionCompletion{ArgsLen: -1, ConfigFile: &cmdr.ConfigFile}
7878
cmd := &cobra.Command{
7979
Use: "auto <action>",
8080
Example: template.CustomExample(
@@ -86,7 +86,7 @@ func tlsAutoCommand(cmdr *commands.DryccCmd) *cobra.Command {
8686
Args: cobra.ExactArgs(1),
8787
ValidArgs: []string{"enable", "disable"},
8888
Short: i18n.T("Automatic certificate management"),
89-
ValidArgsFunction: tlsActionCompletion.CompletionFunc,
89+
ValidArgsFunction: TLSActionCompletion.CompletionFunc,
9090
RunE: func(cmd *cobra.Command, args []string) error {
9191
action := args[0]
9292
if action == "enable" {
@@ -123,8 +123,8 @@ func tlsIssuerCommand(cmdr *commands.DryccCmd) *cobra.Command {
123123
cmd.Flags().StringVar(&flags.keyID, "key-id", "", i18n.T("CA key ID"))
124124
cmd.Flags().StringVar(&flags.keySecret, "key-secret", "", i18n.T("CA key secret"))
125125

126-
must_flags := []string{"email", "server", "key-id", "key-secret"}
127-
for _, must_flag := range must_flags {
126+
mustFlags := []string{"email", "server", "key-id", "key-secret"}
127+
for _, must_flag := range mustFlags {
128128
cmd.MarkFlagRequired(must_flag)
129129
}
130130

internal/parser/tokens.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,8 +67,8 @@ func tokensAddCommand(cmdr *commands.DryccCmd) *cobra.Command {
6767
cmd.Flags().StringVarP(&flags.username, "username", "u", "", i18n.T("Provide a username for the account"))
6868
cmd.Flags().StringVarP(&flags.password, "password", "p", "", i18n.T("Provide a password for the account"))
6969

70-
must_flags := []string{"username", "password"}
71-
for _, must_flag := range must_flags {
70+
mustFlags := []string{"username", "password"}
71+
for _, must_flag := range mustFlags {
7272
cmd.MarkFlagRequired(must_flag)
7373
}
7474

internal/parser/version.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,14 @@ func NewVersionCommand(cmdr *commands.DryccCmd) *cobra.Command {
1111
var flags struct {
1212
all bool
1313
}
14-
DryccCmd := &cobra.Command{
14+
cmd := &cobra.Command{
1515
Use: "version",
1616
Short: i18n.T("Display client version"),
1717
Long: i18n.T("Displays the client version"),
18-
Run: func(DryccCmd *cobra.Command, args []string) {
18+
Run: func(_ *cobra.Command, args []string) {
1919
cmdr.Version(flags.all)
2020
},
2121
}
22-
DryccCmd.Flags().BoolVarP(&flags.all, "all", "a", false, i18n.T("list api and controller versions."))
23-
return DryccCmd
22+
cmd.Flags().BoolVarP(&flags.all, "all", "a", false, i18n.T("list api and controller versions."))
23+
return cmd
2424
}

0 commit comments

Comments
 (0)