Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix goconst linting errors #315

Merged
merged 1 commit into from
Nov 3, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions internal/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,10 @@ const (
nodePortFlagHelp = "Additional TCP port to connect to on remote LOCKSS nodes to verify connectivity. This flag may be repeated for each additional TCP port to check. If not set, this application connects only to the port (usually 9729) specified in the LOCKSS configuration/property XML file."
)

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

// Default flag settings if not overridden by user input. Some constants are
// untyped in order to allow type promotion as needed.
const (
Expand Down
16 changes: 8 additions & 8 deletions internal/config/flags.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,30 +19,30 @@ func (c *Config) handleFlagsConfig() {

log.Debugf("Before parsing flags: %v", c.String())

flag.Var(&c.nodePorts, "p", nodePortFlagHelp+" (shorthand)")
flag.Var(&c.nodePorts, "p", nodePortFlagHelp+shorthandFlagSuffix)
flag.Var(&c.nodePorts, "port", nodePortFlagHelp)

flag.StringVar(&c.configServerURL, "cs", defaultConfigServerURL, configServerURLFlagHelp+" (shorthand)")
flag.StringVar(&c.configServerURL, "cs", defaultConfigServerURL, configServerURLFlagHelp+shorthandFlagSuffix)
flag.StringVar(&c.configServerURL, "config-server", defaultConfigServerURL, configServerURLFlagHelp)

flag.IntVar(&c.configServerReadTimeout, "ct", defaultConfigReadTimeout, configReadTimeoutFlagHelp+" (shorthand)")
flag.IntVar(&c.configServerReadTimeout, "ct", defaultConfigReadTimeout, configReadTimeoutFlagHelp+shorthandFlagSuffix)
flag.IntVar(&c.configServerReadTimeout, "config-read-timeout", defaultConfigReadTimeout, configReadTimeoutFlagHelp)

flag.IntVar(&c.portConnectTimeout, "pt", defaultPortConnectTimeout, portConnectTimeoutFlagHelp+" (shorthand)")
flag.IntVar(&c.portConnectTimeout, "pt", defaultPortConnectTimeout, portConnectTimeoutFlagHelp+shorthandFlagSuffix)
flag.IntVar(&c.portConnectTimeout, "port-timeout", defaultPortConnectTimeout, portConnectTimeoutFlagHelp)

flag.StringVar(&c.configFile, "cf", defaultConfigFile, configFileFlagHelp+" (shorthand)")
flag.StringVar(&c.configFile, "cf", defaultConfigFile, configFileFlagHelp+shorthandFlagSuffix)
flag.StringVar(&c.configFile, "config-file", defaultConfigFile, configFileFlagHelp)

flag.BoolVar(&c.showVersion, "version", defaultDisplayVersionAndExit, versionFlagHelp)
flag.BoolVar(&c.showVersion, "v", defaultDisplayVersionAndExit, versionFlagHelp+" (shorthand)")
flag.BoolVar(&c.showVersion, "v", defaultDisplayVersionAndExit, versionFlagHelp+shorthandFlagSuffix)

// create shorter and longer logging level flag options
flag.StringVar(&c.logLevel, "ll", defaultLogLevel, logLevelFlagHelp+" (shorthand)")
flag.StringVar(&c.logLevel, "ll", defaultLogLevel, logLevelFlagHelp+shorthandFlagSuffix)
flag.StringVar(&c.logLevel, "log-level", defaultLogLevel, logLevelFlagHelp)

// create shorter and longer logging format flag options
flag.StringVar(&c.logFormat, "lf", defaultLogFormat, logFormatFlagHelp+" (shorthand)")
flag.StringVar(&c.logFormat, "lf", defaultLogFormat, logFormatFlagHelp+shorthandFlagSuffix)
flag.StringVar(&c.logFormat, "log-format", defaultLogFormat, logFormatFlagHelp)

flag.Usage = flagsUsage()
Expand Down
Loading