1
0
mirror of https://blitiri.com.ar/repos/chasquid synced 2025-12-17 14:37:02 +00:00

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.
This commit is contained in:
Alberto Bertogli
2021-10-08 17:36:31 +01:00
parent 07c133fd15
commit fcdc49d742
2 changed files with 4 additions and 7 deletions

View File

@@ -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)

2
go.mod
View File

@@ -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
)