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 errcheck linting errors #275

Merged
merged 1 commit into from
Jun 1, 2024
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
26 changes: 13 additions & 13 deletions cmd/check_ssh_login/summary.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,95 +55,95 @@ func setLongServiceOutput(extendedMessage string, client *ssh.Client, cfg *confi
// nagios.CheckOutputEOL,
// )

fmt.Fprintf(
_, _ = fmt.Fprintf(
&report,
"%sConfiguration settings: %s%s",
nagios.CheckOutputEOL,
nagios.CheckOutputEOL,
nagios.CheckOutputEOL,
)

fmt.Fprintf(
_, _ = fmt.Fprintf(
&report,
"* Server: %v%s",
cfg.Server,
nagios.CheckOutputEOL,
)

fmt.Fprintf(
_, _ = fmt.Fprintf(
&report,
"* Port: %v%s",
cfg.TCPPort,
nagios.CheckOutputEOL,
)

fmt.Fprintf(
_, _ = fmt.Fprintf(
&report,
"* Username: %v%s",
cfg.Username,
nagios.CheckOutputEOL,
)

fmt.Fprintf(
_, _ = fmt.Fprintf(
&report,
"* NetworkType: %v%s",
cfg.NetworkType,
nagios.CheckOutputEOL,
)

fmt.Fprintf(
_, _ = fmt.Fprintf(
&report,
"* Timeout: %v%s",
cfg.Timeout(),
nagios.CheckOutputEOL,
)

fmt.Fprintf(
_, _ = fmt.Fprintf(
&report,
"* LoginFailureState: %v%s",
strings.ToUpper(cfg.LoginFailureState),
nagios.CheckOutputEOL,
)

fmt.Fprintf(
_, _ = fmt.Fprintf(
&report,
"* LoginSuccessState: %v%s",
strings.ToUpper(cfg.LoginSuccessState),
nagios.CheckOutputEOL,
)

if extendedMessage != "" {
fmt.Fprintf(
_, _ = fmt.Fprintf(
&report,
"%s------%s%s",
nagios.CheckOutputEOL,
nagios.CheckOutputEOL,
nagios.CheckOutputEOL,
)

fmt.Fprintf(
_, _ = fmt.Fprintf(
&report,
"%s%s",
nagios.CheckOutputEOL,
extendedMessage,
)
}

fmt.Fprintf(
_, _ = fmt.Fprintf(
&report,
"%s",
nagios.CheckOutputEOL,
)

if cfg.ShowVerbose {
if client != nil {
fmt.Fprintf(
_, _ = fmt.Fprintf(
&report,
"SSH Client version: %s%s",
client.ClientVersion(),
nagios.CheckOutputEOL,
)
fmt.Fprintf(
_, _ = fmt.Fprintf(
&report,
"SSH Server version: %s%s",
client.ServerVersion(),
Expand Down
8 changes: 4 additions & 4 deletions internal/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,7 @@ func Usage(flagSet *flag.FlagSet, w io.Writer) func() {
// Uninitialized flagset, provide stub usage information.
case flagSet == nil:
return func() {
fmt.Fprintln(w, "Failed to initialize configuration; nil FlagSet")
_, _ = fmt.Fprintln(w, "Failed to initialize configuration; nil FlagSet")
}

// Non-nil flagSet, proceed
Expand All @@ -226,8 +226,8 @@ func Usage(flagSet *flag.FlagSet, w io.Writer) func() {
flagSet.SetOutput(w)

return func() {
fmt.Fprintln(flag.CommandLine.Output(), "\n"+Version()+"\n")
fmt.Fprintf(flag.CommandLine.Output(), "Usage of %s:\n", os.Args[0])
_, _ = fmt.Fprintln(flag.CommandLine.Output(), "\n"+Version()+"\n")
_, _ = fmt.Fprintf(flag.CommandLine.Output(), "Usage of %s:\n", os.Args[0])
flagSet.PrintDefaults()
}
}
Expand All @@ -245,7 +245,7 @@ func (c *Config) Help() string {
// Handle nil configuration initialization.
case c == nil || c.flagSet == nil:
// Fallback message noting the issue.
fmt.Fprintln(&helpTxt, ErrConfigNotInitialized)
_, _ = fmt.Fprintln(&helpTxt, ErrConfigNotInitialized)

default:
// Emit expected help output to builder.
Expand Down
Loading