Skip to content

Commit 117698a

Browse files
authored
refactor: replace several vars with consts (#2328)
1 parent e2dd29d commit 117698a

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

command.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -567,7 +567,7 @@ func (c *Command) UsagePadding() int {
567567
return c.parent.commandsMaxUseLen
568568
}
569569

570-
var minCommandPathPadding = 11
570+
const minCommandPathPadding = 11
571571

572572
// CommandPathPadding return padding for the command path.
573573
func (c *Command) CommandPathPadding() int {
@@ -577,7 +577,7 @@ func (c *Command) CommandPathPadding() int {
577577
return c.parent.commandsMaxCommandPathLen
578578
}
579579

580-
var minNamePadding = 11
580+
const minNamePadding = 11
581581

582582
// NamePadding returns padding for the name.
583583
func (c *Command) NamePadding() int {
@@ -1939,7 +1939,7 @@ type tmplFunc struct {
19391939
fn func(io.Writer, interface{}) error
19401940
}
19411941

1942-
var defaultUsageTemplate = `Usage:{{if .Runnable}}
1942+
const defaultUsageTemplate = `Usage:{{if .Runnable}}
19431943
{{.UseLine}}{{end}}{{if .HasAvailableSubCommands}}
19441944
{{.CommandPath}} [command]{{end}}{{if gt (len .Aliases) 0}}
19451945
@@ -2039,7 +2039,7 @@ func defaultUsageFunc(w io.Writer, in interface{}) error {
20392039
return nil
20402040
}
20412041

2042-
var defaultHelpTemplate = `{{with (or .Long .Short)}}{{. | trimTrailingWhitespaces}}
2042+
const defaultHelpTemplate = `{{with (or .Long .Short)}}{{. | trimTrailingWhitespaces}}
20432043
20442044
{{end}}{{if or .Runnable .HasSubCommands}}{{.UsageString}}{{end}}`
20452045

@@ -2061,7 +2061,7 @@ func defaultHelpFunc(w io.Writer, in interface{}) error {
20612061
return nil
20622062
}
20632063

2064-
var defaultVersionTemplate = `{{with .DisplayName}}{{printf "%s " .}}{{end}}{{printf "version %s" .Version}}
2064+
const defaultVersionTemplate = `{{with .DisplayName}}{{printf "%s " .}}{{end}}{{printf "version %s" .Version}}
20652065
`
20662066

20672067
// defaultVersionFunc is equivalent to executing defaultVersionTemplate. The two should be changed in sync.

0 commit comments

Comments
 (0)