From eeb49ba210981f292b755ffababc100c2ae87f06 Mon Sep 17 00:00:00 2001 From: Carlos Alexandro Becker Date: Thu, 29 Aug 2024 09:53:08 -0300 Subject: [PATCH] fix: lint issues Signed-off-by: Carlos Alexandro Becker --- .golangci.yml | 1 - client.go | 3 +-- client_auth.go | 2 ++ client_local.go | 1 + client_unix.go | 1 + 5 files changed, 5 insertions(+), 3 deletions(-) diff --git a/.golangci.yml b/.golangci.yml index a5a91d0..684d54b 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -15,7 +15,6 @@ issues: linters: enable: - bodyclose - - exportloopref - goimports - gosec - nilerr diff --git a/client.go b/client.go index 0b1e1bd..ce2b90a 100644 --- a/client.go +++ b/client.go @@ -109,8 +109,7 @@ func (c closers) close() { } } -// nolint: errcheck -func resetPty(w io.Writer) { +func resetPty(w io.Writer) { //nolint:errcheck fmt.Fprint(w, termenv.CSI+termenv.ExitAltScreenSeq) fmt.Fprint(w, termenv.CSI+termenv.ResetSeq+"m") fmt.Fprintf(w, termenv.CSI+termenv.EraseDisplaySeq, 2) //nolint:mnd diff --git a/client_auth.go b/client_auth.go index 5d19c3b..6c11609 100644 --- a/client_auth.go +++ b/client_auth.go @@ -284,6 +284,7 @@ func parsePrivateKey(path string, password []byte) (gossh.AuthMethod, error) { pwderr := &gossh.PassphraseMissingError{} if errors.As(err, &pwderr) { fmt.Printf("Enter the password for %q: ", path) + // #nosec G115 password, err := term.ReadPassword(int(os.Stdin.Fd())) fmt.Println() if err != nil { @@ -336,6 +337,7 @@ func hostKeyCallback(e *Endpoint, path string) gossh.HostKeyCallback { } } +// #nosec G115 func askUser(in io.Reader, echo bool) (string, error) { if !echo { if f, ok := in.(*os.File); ok && term.IsTerminal(int(f.Fd())) { diff --git a/client_local.go b/client_local.go index 5bc8a7e..7f98a3c 100644 --- a/client_local.go +++ b/client_local.go @@ -111,6 +111,7 @@ func (s *localSession) Run() error { //nolint:nestif if s.endpoint.RequestTTY || s.endpoint.RemoteCommand == "" { + // #nosec G115 fd := int(os.Stdout.Fd()) if !term.IsTerminal(fd) { return fmt.Errorf("requested a TTY, but current session is not TTY, aborting") diff --git a/client_unix.go b/client_unix.go index 6c46bef..513ffcd 100644 --- a/client_unix.go +++ b/client_unix.go @@ -27,6 +27,7 @@ func (s *localSession) notifyWindowChanges(ctx context.Context, session *ssh.Ses case <-ctx.Done(): return case <-sig: + // #nosec G115 w, h, err := term.GetSize(int(os.Stdout.Fd())) if err != nil { log.Info("could not get term size", "err", err)