Skip to content

Commit

Permalink
fix: lint issues
Browse files Browse the repository at this point in the history
Signed-off-by: Carlos Alexandro Becker <[email protected]>
  • Loading branch information
caarlos0 committed Aug 29, 2024
1 parent 97e122a commit eeb49ba
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 3 deletions.
1 change: 0 additions & 1 deletion .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ issues:
linters:
enable:
- bodyclose
- exportloopref
- goimports
- gosec
- nilerr
Expand Down
3 changes: 1 addition & 2 deletions client.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 2 additions & 0 deletions client_auth.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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())) {
Expand Down
1 change: 1 addition & 0 deletions client_local.go
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down
1 change: 1 addition & 0 deletions client_unix.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit eeb49ba

Please sign in to comment.