Skip to content

Commit

Permalink
Fix goconst linting errors
Browse files Browse the repository at this point in the history
Replace literal text with new `shorthandFlagSuffix` config constant.
  • Loading branch information
atc0005 committed Nov 15, 2023
1 parent 8cc0af9 commit 3fbe562
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
4 changes: 4 additions & 0 deletions internal/config/constants.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,10 @@ const (
disableDefaultIgnoredFlagHelp string = "Disables use of default ignored assertion path entries."
)

// shorthandFlagSuffix is appended to short flag help text to emphasize that
// the flag is a shorthand version of a longer flag.
const shorthandFlagSuffix = " (shorthand)"

// Flag names for consistent references. Exported so that they're available
// from tests.
const (
Expand Down
10 changes: 5 additions & 5 deletions internal/config/flags.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,13 +60,13 @@ func (c *Config) handleFlagsConfig(appType AppType) {

flag.BoolVar(&c.EmitBranding, BrandingFlag, defaultBranding, brandingFlagHelp)

flag.BoolVar(&c.VerboseOutput, VerboseFlagShort, defaultVerboseOutput, verboseOutputFlagHelp+" (shorthand)")
flag.BoolVar(&c.VerboseOutput, VerboseFlagShort, defaultVerboseOutput, verboseOutputFlagHelp+shorthandFlagSuffix)
flag.BoolVar(&c.VerboseOutput, VerboseFlagLong, defaultVerboseOutput, verboseOutputFlagHelp)

flag.BoolVar(&c.ShowIgnored, ShowIgnoredFlagShort, defaultShowIgnored, showIgnoredFlagHelp+" (shorthand)")
flag.BoolVar(&c.ShowIgnored, ShowIgnoredFlagShort, defaultShowIgnored, showIgnoredFlagHelp+shorthandFlagSuffix)
flag.BoolVar(&c.ShowIgnored, ShowIgnoredFlagLong, defaultShowIgnored, showIgnoredFlagHelp)

flag.BoolVar(&c.DisableDefaultIgnored, DisableDefaultIgnoredFlagShort, defaultDisableDefaultIgnored, disableDefaultIgnoredFlagHelp+" (shorthand)")
flag.BoolVar(&c.DisableDefaultIgnored, DisableDefaultIgnoredFlagShort, defaultDisableDefaultIgnored, disableDefaultIgnoredFlagHelp+shorthandFlagSuffix)
flag.BoolVar(&c.DisableDefaultIgnored, DisableDefaultIgnoredFlagLong, defaultDisableDefaultIgnored, disableDefaultIgnoredFlagHelp)

case appType.Inspector:
Expand Down Expand Up @@ -96,7 +96,7 @@ func (c *Config) handleFlagsConfig(appType AppType) {

appDescription = "Used to generate a summary of metadata indicating the need to reboot a system or services."

flag.BoolVar(&c.VerboseOutput, VerboseFlagShort, defaultVerboseOutput, verboseOutputFlagHelp+" (shorthand)")
flag.BoolVar(&c.VerboseOutput, VerboseFlagShort, defaultVerboseOutput, verboseOutputFlagHelp+shorthandFlagSuffix)
flag.BoolVar(&c.VerboseOutput, VerboseFlagLong, defaultVerboseOutput, verboseOutputFlagHelp)

}
Expand All @@ -107,7 +107,7 @@ func (c *Config) handleFlagsConfig(appType AppType) {
&c.LoggingLevel,
LogLevelFlagShort,
defaultLogLevel,
supportedValuesFlagHelpText(logLevelFlagHelp, supportedLogLevels())+" (shorthand)",
supportedValuesFlagHelpText(logLevelFlagHelp, supportedLogLevels())+shorthandFlagSuffix,
)
flag.StringVar(
&c.LoggingLevel,
Expand Down

0 comments on commit 3fbe562

Please sign in to comment.