Fixup golang.org/x/term staticcheck warnings

Errors from staticcheck:
cmd/preferredimports/preferredimports.go:38:2:
  package golang.org/x/crypto/ssh/terminal is deprecated:
  this package moved to golang.org/x/term.  (SA1019)
vendor/k8s.io/client-go/plugin/pkg/client/auth/exec/exec.go:36:2:
  package golang.org/x/crypto/ssh/terminal is deprecated:
  this package moved to golang.org/x/term.  (SA1019)
vendor/k8s.io/client-go/tools/clientcmd/auth_loaders.go:26:2:
  package golang.org/x/crypto/ssh/terminal is deprecated:
  this package moved to golang.org/x/term.  (SA1019)

Please review the above warnings. You can test via:
  hack/verify-staticcheck.sh <failing package>
If the above warnings do not make sense, you can exempt the line or
file. See:
  https://staticcheck.io/docs/#ignoring-problems

generated:
- hack/update-internal-modules.sh
- hack/lint-dependencies.sh
- hack/update-vendor.sh

Signed-off-by: Stephen Augustus <foo@auggie.dev>

Kubernetes-commit: d9435800b65d6787beaf061546599d757b8e87c9
This commit is contained in:
Stephen Augustus
2021-03-02 00:14:47 -05:00
committed by Kubernetes Publisher
parent 768a62f124
commit b13f594878
4 changed files with 10 additions and 7 deletions

View File

@@ -23,7 +23,7 @@ import (
"io/ioutil"
"os"
"golang.org/x/crypto/ssh/terminal"
"golang.org/x/term"
clientauth "k8s.io/client-go/tools/auth"
)
@@ -90,8 +90,8 @@ func promptForString(field string, r io.Reader, show bool) (result string, err e
_, err = fmt.Fscan(r, &result)
} else {
var data []byte
if terminal.IsTerminal(int(os.Stdin.Fd())) {
data, err = terminal.ReadPassword(int(os.Stdin.Fd()))
if term.IsTerminal(int(os.Stdin.Fd())) {
data, err = term.ReadPassword(int(os.Stdin.Fd()))
result = string(data)
} else {
return "", fmt.Errorf("error reading input for %s", field)