Skip to content

Commit 38ab12d

Browse files
committed
fix(workflow-cli): lint error
1 parent a97022a commit 38ab12d

36 files changed

Lines changed: 224 additions & 229 deletions

cmd/root.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ func NewDryccCommand() *cobra.Command {
2525
rootCmd := &cobra.Command{
2626
Use: "drycc",
2727
Short: i18n.T("The Drycc command-line client issues API calls to a Drycc controller"),
28-
PersistentPreRun: func(cmd *cobra.Command, args []string) {
28+
PersistentPreRun: func(_ *cobra.Command, _ []string) {
2929
cmdr = commands.DryccCmd{ConfigFile: flags.config, WOut: os.Stdout, WErr: os.Stderr, WIn: os.Stdin, Location: time.Local}
3030
},
3131
}

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: 35 additions & 41 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 {
@@ -361,12 +358,12 @@ func (c *LimitSetPlanCompletion) CompletionFunc(cmd *cobra.Command, args []strin
361358
}
362359
}
363360
return results, cobra.ShellCompDirectiveNoFileComp
364-
} else {
365-
ptsSetArgsCompletion := PtsSetArgsCompletion{
366-
PtsCompletion: &PtsCompletion{AppID: c.AppID, ArgsLen: -1, ConfigFile: c.ConfigFile},
367-
}
368-
return ptsSetArgsCompletion.CompletionFunc(cmd, args, toComplete)
369361
}
362+
ptsSetArgsCompletion := PtsSetArgsCompletion{
363+
PtsCompletion: &PtsCompletion{AppID: c.AppID, ArgsLen: -1, ConfigFile: c.ConfigFile},
364+
}
365+
return ptsSetArgsCompletion.CompletionFunc(cmd, args, toComplete)
366+
370367
}
371368

372369
type UserPermsCompletion struct {
@@ -439,12 +436,11 @@ func (c *PermUpdateCompletion) CompletionFunc(cmd *cobra.Command, args []string,
439436
if len(args) == 0 {
440437
permUsernameCompletion := PermUsernameCompletion{AppID: c.AppID, ArgsLen: 0, ConfigFile: c.ConfigFile}
441438
return permUsernameCompletion.CompletionFunc(cmd, args, toComplete)
442-
} else {
443-
userPermsArgsCompletion := UserPermsArgsCompletion{
444-
UserPermsCompletion: &UserPermsCompletion{ConfigFile: c.ConfigFile},
445-
}
446-
return userPermsArgsCompletion.CompletionFunc(cmd, args, toComplete)
447439
}
440+
userPermsArgsCompletion := UserPermsArgsCompletion{
441+
UserPermsCompletion: &UserPermsCompletion{ConfigFile: c.ConfigFile},
442+
}
443+
return userPermsArgsCompletion.CompletionFunc(cmd, args, toComplete)
448444
}
449445

450446
type PsCompletion struct {
@@ -555,7 +551,7 @@ type ResourcePlanCompletion struct {
555551
ConfigFile *string
556552
}
557553

558-
func (c *ResourcePlanCompletion) CompletionFunc(_ *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) {
554+
func (c *ResourcePlanCompletion) CompletionFunc(_ *cobra.Command, args []string, _ string) ([]string, cobra.ShellCompDirective) {
559555
if s, err := settings.Load(*c.ConfigFile); err == nil && (c.ArgsLen < 0 || len(args) == c.ArgsLen) {
560556
var results []string
561557
if services, _, err := resources.Plans(s.Client, c.Service, -1); err == nil {
@@ -735,12 +731,12 @@ func (c *TagCompletion) CompletionFunc(_ *cobra.Command, args []string, toComple
735731
return nil, cobra.ShellCompDirectiveNoFileComp
736732
}
737733

738-
type TlsActionCompletion struct {
734+
type TLSActionCompletion struct {
739735
ArgsLen int
740736
ConfigFile *string
741737
}
742738

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

@@ -828,12 +824,11 @@ func (c *VolumesMountCompletion) CompletionFunc(cmd *cobra.Command, args []strin
828824
if len(args) == 0 {
829825
volumeCompletion := VolumeCompletion{AppID: c.AppID, ArgsLen: 0, ConfigFile: c.ConfigFile}
830826
return volumeCompletion.CompletionFunc(cmd, args, toComplete)
831-
} else {
832-
ptsSetArgsCompletion := PtsSetArgsCompletion{
833-
PtsCompletion: &PtsCompletion{AppID: c.AppID, ArgsLen: -1, ConfigFile: c.ConfigFile},
834-
}
835-
return ptsSetArgsCompletion.CompletionFunc(cmd, args, toComplete)
836827
}
828+
ptsSetArgsCompletion := PtsSetArgsCompletion{
829+
PtsCompletion: &PtsCompletion{AppID: c.AppID, ArgsLen: -1, ConfigFile: c.ConfigFile},
830+
}
831+
return ptsSetArgsCompletion.CompletionFunc(cmd, args, toComplete)
837832
}
838833

839834
type VolumesUnmountCompletion struct {
@@ -846,12 +841,11 @@ func (c *VolumesUnmountCompletion) CompletionFunc(cmd *cobra.Command, args []str
846841
if len(args) == 0 {
847842
volumeCompletion := VolumeCompletion{AppID: c.AppID, ArgsLen: 0, ConfigFile: c.ConfigFile}
848843
return volumeCompletion.CompletionFunc(cmd, args, toComplete)
849-
} else {
850-
ptsArgCompletion := PtsArgsCompletion{
851-
PtsCompletion: &PtsCompletion{AppID: c.AppID, ArgsLen: -1, ConfigFile: c.ConfigFile},
852-
}
853-
return ptsArgCompletion.CompletionFunc(cmd, args, toComplete)
854844
}
845+
ptsArgCompletion := PtsArgsCompletion{
846+
PtsCompletion: &PtsCompletion{AppID: c.AppID, ArgsLen: -1, ConfigFile: c.ConfigFile},
847+
}
848+
return ptsArgCompletion.CompletionFunc(cmd, args, toComplete)
855849
}
856850

857851
type VolumesCmdCompletion struct {

internal/parser/apps.go

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ func NewAppsCommand(cmdr *commands.DryccCmd) *cobra.Command {
1515
cmd := &cobra.Command{
1616
Use: "apps",
1717
Short: i18n.T("Manage applications used to provide services"),
18-
RunE: func(cmd *cobra.Command, args []string) error {
18+
RunE: func(_ *cobra.Command, _ []string) error {
1919
return cmdr.AppsList(limit)
2020
},
2121
}
@@ -43,7 +43,7 @@ func appsCreate(cmdr *commands.DryccCmd) *cobra.Command {
4343
Args: cobra.MaximumNArgs(1),
4444
Short: i18n.T("Create a new application"),
4545
Long: i18n.T(`Creates a new application. If no <id> is provided, one will be generated automatically`),
46-
RunE: func(cmd *cobra.Command, args []string) error {
46+
RunE: func(_ *cobra.Command, args []string) error {
4747
id := ""
4848
if len(args) > 0 {
4949
id = args[0]
@@ -64,7 +64,7 @@ func appsList(cmdr *commands.DryccCmd) *cobra.Command {
6464
Use: "list",
6565
Short: i18n.T("List accessible applications"),
6666
Long: i18n.T("Lists applications visible to the current user"),
67-
RunE: func(cmd *cobra.Command, args []string) error {
67+
RunE: func(_ *cobra.Command, _ []string) error {
6868
return cmdr.AppsList(limit)
6969
},
7070
}
@@ -80,7 +80,7 @@ func appsInfo(cmdr *commands.DryccCmd) *cobra.Command {
8080
Use: "info",
8181
Short: i18n.T("View info about an application"),
8282
Long: i18n.T("Prints info about the current application"),
83-
RunE: func(cmd *cobra.Command, args []string) error {
83+
RunE: func(_ *cobra.Command, _ []string) error {
8484
return cmdr.AppInfo(app)
8585
},
8686
}
@@ -99,7 +99,7 @@ func appsOpen(cmdr *commands.DryccCmd) *cobra.Command {
9999
Use: "open",
100100
Short: i18n.T("Open the application in a browser"),
101101
Long: i18n.T("Opens a URL to the application in the default browser"),
102-
RunE: func(cmd *cobra.Command, args []string) error {
102+
RunE: func(_ *cobra.Command, _ []string) error {
103103
return cmdr.AppOpen(app)
104104
},
105105
}
@@ -124,7 +124,7 @@ func appsLogs(cmdr *commands.DryccCmd) *cobra.Command {
124124
Use: "logs",
125125
Short: i18n.T("Retrieve application log events"),
126126
Long: i18n.T("Retrieves the most recent log events"),
127-
RunE: func(cmd *cobra.Command, args []string) error {
127+
RunE: func(_ *cobra.Command, _ []string) error {
128128
return cmdr.AppLogs(app, flags.lines, flags.follow, flags.timeout)
129129
},
130130
}
@@ -161,7 +161,7 @@ func appsRun(cmdr *commands.DryccCmd) *cobra.Command {
161161
),
162162
Short: i18n.T("Run a command in an ephemeral app container"),
163163
Long: i18n.T("Runs a command inside an ephemeral app container"),
164-
RunE: func(cmd *cobra.Command, args []string) error {
164+
RunE: func(_ *cobra.Command, args []string) error {
165165
command := strings.Join(args, " ")
166166
return cmdr.AppRun(app, command, flags.mounts, flags.timeout, flags.expires)
167167
},
@@ -188,7 +188,7 @@ func appsDestroy(cmdr *commands.DryccCmd) *cobra.Command {
188188
Use: "destroy",
189189
Example: "drycc apps destroy -a <app> --confirm <app>",
190190
Short: i18n.T("Destroy an application"),
191-
RunE: func(cmd *cobra.Command, args []string) error {
191+
RunE: func(_ *cobra.Command, _ []string) error {
192192
return cmdr.AppDestroy(app, flags.confirm)
193193
},
194194
}
@@ -208,7 +208,7 @@ func appsTransfer(cmdr *commands.DryccCmd) *cobra.Command {
208208
Args: cobra.ExactArgs(1),
209209
Short: i18n.T("Transfer app ownership to another user"),
210210
Long: i18n.T("Transfer application ownership to another user."),
211-
RunE: func(cmd *cobra.Command, args []string) error {
211+
RunE: func(_ *cobra.Command, args []string) error {
212212
user := args[0]
213213
return cmdr.AppTransfer(app, user)
214214
},

internal/parser/auth.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ func authLogin(cmdr *commands.DryccCmd) *cobra.Command {
3333
Example: "drycc auth login http://drycc.local3.dryccapp.com/",
3434
Short: i18n.T("Authenticate against a controller"),
3535
Long: i18n.T("Logs in by authenticating against a controller"),
36-
RunE: func(cmd *cobra.Command, args []string) error {
36+
RunE: func(_ *cobra.Command, args []string) error {
3737
controller := args[0]
3838
return cmdr.Login(controller, flags.sslVerify, flags.username, flags.password)
3939
},
@@ -52,7 +52,7 @@ func authLogout(cmdr *commands.DryccCmd) *cobra.Command {
5252
Example: "drycc auth logout",
5353
Short: i18n.T("Clear the current user session"),
5454
Long: i18n.T("Logs out from a controller and clears the user session"),
55-
RunE: func(cmd *cobra.Command, args []string) error {
55+
RunE: func(_ *cobra.Command, _ []string) error {
5656
return cmdr.Logout()
5757
},
5858
}
@@ -70,7 +70,7 @@ func authWhoami(cmdr *commands.DryccCmd) *cobra.Command {
7070
Example: "drycc auth whoami",
7171
Short: i18n.T("Display the current user"),
7272
Long: i18n.T("Displays the currently logged in user"),
73-
RunE: func(cmd *cobra.Command, args []string) error {
73+
RunE: func(_ *cobra.Command, _ []string) error {
7474
return cmdr.Whoami(flags.all)
7575
},
7676
}

internal/parser/autodeploy.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ func NewAutodeployCommand(cmdr *commands.DryccCmd) *cobra.Command {
1313
cmd := &cobra.Command{
1414
Use: "autodeploy",
1515
Short: i18n.T("Manage autodeploy if or not for applications"),
16-
RunE: func(cmd *cobra.Command, args []string) error {
16+
RunE: func(_ *cobra.Command, _ []string) error {
1717
return cmdr.AutodeployInfo(app)
1818
},
1919
}
@@ -33,7 +33,7 @@ func autodeployInfo(cmdr *commands.DryccCmd) *cobra.Command {
3333
cmd := &cobra.Command{
3434
Use: "info",
3535
Short: i18n.T("Prints info about the current application's autodeploy if or not"),
36-
RunE: func(cmd *cobra.Command, args []string) error {
36+
RunE: func(_ *cobra.Command, _ []string) error {
3737
return cmdr.AutodeployInfo(app)
3838
},
3939
}
@@ -45,7 +45,7 @@ func autodeployEnable(cmdr *commands.DryccCmd) *cobra.Command {
4545
cmd := &cobra.Command{
4646
Use: "enable",
4747
Short: i18n.T("Enables autodeploy for an app"),
48-
RunE: func(cmd *cobra.Command, args []string) error {
48+
RunE: func(_ *cobra.Command, _ []string) error {
4949
return cmdr.AutodeployEnable(app)
5050
},
5151
}
@@ -57,7 +57,7 @@ func autodeployDisable(cmdr *commands.DryccCmd) *cobra.Command {
5757
cmd := &cobra.Command{
5858
Use: "disable",
5959
Short: i18n.T("Disables autodeploy for an app"),
60-
RunE: func(cmd *cobra.Command, args []string) error {
60+
RunE: func(_ *cobra.Command, _ []string) error {
6161
return cmdr.AutodeployDisable(app)
6262
},
6363
}

internal/parser/autorollback.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ func NewAutorollbackCommand(cmdr *commands.DryccCmd) *cobra.Command {
1212
cmd := &cobra.Command{
1313
Use: "autorollback",
1414
Short: i18n.T("Manage autorollback if or not for application"),
15-
RunE: func(cmd *cobra.Command, args []string) error {
15+
RunE: func(_ *cobra.Command, _ []string) error {
1616
return cmdr.AutorollbackInfo(app)
1717
},
1818
}
@@ -32,7 +32,7 @@ func autorollbackInfo(cmdr *commands.DryccCmd) *cobra.Command {
3232
Use: "info",
3333
Short: i18n.T("View autorollback info for an application"),
3434
Long: i18n.T("Prints info about the current application's autorollback if or not"),
35-
RunE: func(cmd *cobra.Command, args []string) error {
35+
RunE: func(_ *cobra.Command, _ []string) error {
3636
return cmdr.AutorollbackInfo(app)
3737
},
3838
}
@@ -44,7 +44,7 @@ func autorollbackEnable(cmdr *commands.DryccCmd) *cobra.Command {
4444
cmd := &cobra.Command{
4545
Use: "enable",
4646
Short: i18n.T("Enable autorollback for an application"),
47-
RunE: func(cmd *cobra.Command, args []string) error {
47+
RunE: func(_ *cobra.Command, _ []string) error {
4848
return cmdr.AutorollbackEnable(app)
4949
},
5050
}
@@ -56,7 +56,7 @@ func autorollbackDisable(cmdr *commands.DryccCmd) *cobra.Command {
5656
cmd := &cobra.Command{
5757
Use: "disable",
5858
Short: i18n.T("Disable autorollback for an application"),
59-
RunE: func(cmd *cobra.Command, args []string) error {
59+
RunE: func(_ *cobra.Command, _ []string) error {
6060
return cmdr.AutorollbackDisable(app)
6161
},
6262
}

0 commit comments

Comments
 (0)