Skip to content

Commit

Permalink
fix: update golangci-lint
Browse files Browse the repository at this point in the history
  • Loading branch information
caarlos0 committed Jun 27, 2024
1 parent 77f9731 commit 46add50
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 10 deletions.
3 changes: 0 additions & 3 deletions .golangci-soft.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,10 @@ linters:

# disable default linters, they are already enabled in .golangci.yml
disable:
- deadcode
- errcheck
- gosimple
- govet
- ineffassign
- staticcheck
- structcheck
- typecheck
- unused
- varcheck
1 change: 1 addition & 0 deletions client.go
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,7 @@ func (c closers) close() {
}
}

// nolint: errcheck

Check failure on line 112 in client.go

View workflow job for this annotation

GitHub Actions / lint-soft

directive `// nolint: errcheck` should be written without leading space as `//nolint: errcheck` (nolintlint)
func resetPty(w io.Writer) {
fmt.Fprint(w, termenv.CSI+termenv.ExitAltScreenSeq)
fmt.Fprint(w, termenv.CSI+termenv.ResetSeq+"m")
Expand Down
12 changes: 6 additions & 6 deletions client_auth.go
Original file line number Diff line number Diff line change
Expand Up @@ -327,7 +327,7 @@ func hostKeyCallback(e *Endpoint, path string) gossh.HostKeyCallback {
return fmt.Errorf("possible man-in-the-middle attack: %w - if your host's key changed, you might need to edit %q", err, kh.Name())
}
// if want is empty, it means the host was not in the known_hosts file, so lets add it there.
fmt.Fprintln(kh, knownhosts.Line([]string{e.Address}, key))
fmt.Fprintln(kh, knownhosts.Line([]string{e.Address}, key)) //nolint: errcheck
return nil
}
return fmt.Errorf("failed to check known_hosts: %w", err)
Expand Down Expand Up @@ -358,17 +358,17 @@ func askUser(in io.Reader, echo bool) (string, error) {
// keyboardInteractiveAuth implements keyboard interactive authentication.
func keyboardInteractiveAuth(in io.Reader, out io.Writer) gossh.AuthMethod {
scan := func(q string, echo bool) (string, error) {
fmt.Fprint(out, q+" ")
fmt.Fprint(out, q+" ") //nolint: errcheck
answer, err := askUser(in, echo)
if err != nil {
return "", err
}
fmt.Fprintln(out)
fmt.Fprintln(out) //nolint: errcheck
return answer, nil
}
return gossh.KeyboardInteractive(func(name, instruction string, questions []string, echos []bool) (answers []string, err error) {
fmt.Fprintln(out, name)
fmt.Fprintln(out, instruction)
fmt.Fprintln(out, name) //nolint: errcheck
fmt.Fprintln(out, instruction) //nolint: errcheck
for i, q := range questions {
answer, err := scan(q, echos[i])
if err != nil {
Expand All @@ -381,7 +381,7 @@ func keyboardInteractiveAuth(in io.Reader, out io.Writer) gossh.AuthMethod {
}

func passwordAuth(e *Endpoint, in io.Reader, out io.Writer) (gossh.AuthMethod, error) {
fmt.Fprintf(out, "%s password: ", e.Address)
fmt.Fprintf(out, "%s password: ", e.Address) //nolint: errcheck
secret, err := askUser(in, false)
if err != nil {
return nil, fmt.Errorf("could not read password: %w", err)
Expand Down
2 changes: 1 addition & 1 deletion middleware.go
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,6 @@ func mustConnect(session ssh.Session, e *Endpoint) {
wish.Fatal(session, fmt.Errorf("wishlist: %w", err))
return // unreachable
}
fmt.Fprintf(session, "wishlist: closed connection to %q (%s)\n\r", e.Name, e.Address)
fmt.Fprintf(session, "wishlist: closed connection to %q (%s)\n\r", e.Name, e.Address) //nolint: errcheck
_ = session.Exit(0)
}

0 comments on commit 46add50

Please sign in to comment.