From fcdc49d742b5c26b3697744c7e604475830b0e5a Mon Sep 17 00:00:00 2001 From: Alberto Bertogli Date: Fri, 8 Oct 2021 17:36:31 +0100 Subject: [PATCH] chasquid-util: Update ReadPassword dependency Today, we use `golang.org/x/crypto/ssh/terminal` to read passwords. That package is obsolete, replaced with `golang.org/x/term`. We couldn't move them because term wasn't compatible with Go 1.11 which was our oldest supported Go version. Now that we moved to Go 1.15 as the oldest supported version, we can do the update. --- cmd/chasquid-util/chasquid-util.go | 9 +++------ go.mod | 2 +- 2 files changed, 4 insertions(+), 7 deletions(-) diff --git a/cmd/chasquid-util/chasquid-util.go b/cmd/chasquid-util/chasquid-util.go index 57a12db..feb5f3d 100644 --- a/cmd/chasquid-util/chasquid-util.go +++ b/cmd/chasquid-util/chasquid-util.go @@ -21,11 +21,8 @@ import ( "blitiri.com.ar/go/chasquid/internal/envelope" "blitiri.com.ar/go/chasquid/internal/normalize" "blitiri.com.ar/go/chasquid/internal/userdb" + "golang.org/x/term" "google.golang.org/protobuf/encoding/prototext" - - // TODO: Move to golang.org/x/term once we don't support Go 1.11 anymore, - // since this one is deprecated (but still fully functional, so no rush). - "golang.org/x/crypto/ssh/terminal" ) // Usage to show users on --help or invocation errors. @@ -182,14 +179,14 @@ func getPassword() string { } fmt.Printf("Password: ") - p1, err := terminal.ReadPassword(syscall.Stdin) + p1, err := term.ReadPassword(syscall.Stdin) fmt.Printf("\n") if err != nil { Fatalf("Error reading password: %v\n", err) } fmt.Printf("Confirm password: ") - p2, err := terminal.ReadPassword(syscall.Stdin) + p2, err := term.ReadPassword(syscall.Stdin) fmt.Printf("\n") if err != nil { Fatalf("Error reading password: %v", err) diff --git a/go.mod b/go.mod index 2924f54..7820a0d 100644 --- a/go.mod +++ b/go.mod @@ -10,7 +10,7 @@ require ( golang.org/x/crypto v0.0.0-20210513164829-c07d793c2f9a golang.org/x/net v0.0.0-20210525063256-abc453219eb5 golang.org/x/sys v0.0.0-20210531080801-fdfd190a6549 // indirect - golang.org/x/term v0.0.0-20210503060354-a79de5458b56 // indirect + golang.org/x/term v0.0.0-20210503060354-a79de5458b56 golang.org/x/text v0.3.6 google.golang.org/protobuf v1.26.0 )