From 54c1106616cfc71fba3a8d45aef38fbff2ce31a0 Mon Sep 17 00:00:00 2001 From: Sergey Matveev Date: Fri, 8 Jan 2021 11:48:19 +0300 Subject: [PATCH] Replace golang.org/x/ssh/terminal with golang.org/x/term --- makedist.sh | 4 ---- src/cfg.go | 4 ++-- src/cmd/nncp-cfgenc/main.go | 8 ++++---- src/go.mod | 1 + 4 files changed, 7 insertions(+), 10 deletions(-) diff --git a/makedist.sh b/makedist.sh index 8a69c09..e62491f 100755 --- a/makedist.sh +++ b/makedist.sh @@ -33,9 +33,6 @@ golang.org/x/term " for mod in $mods; do mod_path=$(sed -n "s# // indirect## ; s#^ \($mod\) \(.*\)\$#\1@\2#p" src/$mod_name/go.mod) - [ -n "$mod_path" ] || { - mod_path=$(sed -n "s#\($mod\) \([^/]*\) .*\$#\1@\2#p" src/$mod_name/go.sum) - } [ -n "$mod_path" ] mkdir -p src/$mod ( cd $GOPATH/pkg/mod/$mod_path ; tar cf - --exclude ".git*" * ) | tar xfC - src/$mod @@ -60,7 +57,6 @@ golang.org/x/crypto/PATENTS golang.org/x/crypto/poly1305 golang.org/x/crypto/README.md golang.org/x/crypto/salsa20 -golang.org/x/crypto/ssh/terminal golang.org/x/net/AUTHORS golang.org/x/net/CONTRIBUTORS golang.org/x/net/go.mod diff --git a/src/cfg.go b/src/cfg.go index d603a5a..50ad498 100644 --- a/src/cfg.go +++ b/src/cfg.go @@ -30,7 +30,7 @@ import ( "github.com/gorhill/cronexpr" "github.com/hjson/hjson-go" "golang.org/x/crypto/ed25519" - "golang.org/x/crypto/ssh/terminal" + "golang.org/x/term" ) const ( @@ -377,7 +377,7 @@ func CfgParse(data []byte) (*Ctx, error) { var err error if bytes.Compare(data[:8], MagicNNCPBv3[:]) == 0 { os.Stderr.WriteString("Passphrase:") // #nosec G104 - password, err := terminal.ReadPassword(0) + password, err := term.ReadPassword(0) if err != nil { log.Fatalln(err) } diff --git a/src/cmd/nncp-cfgenc/main.go b/src/cmd/nncp-cfgenc/main.go index 7eb6766..7fdb5d7 100644 --- a/src/cmd/nncp-cfgenc/main.go +++ b/src/cmd/nncp-cfgenc/main.go @@ -30,7 +30,7 @@ import ( xdr "github.com/davecgh/go-xdr/xdr2" "go.cypherpunks.ru/nncp/v5" "golang.org/x/crypto/blake2b" - "golang.org/x/crypto/ssh/terminal" + "golang.org/x/term" ) func usage() { @@ -90,7 +90,7 @@ func main() { } os.Stderr.WriteString("Passphrase:") // #nosec G104 - password, err := terminal.ReadPassword(0) + password, err := term.ReadPassword(0) if err != nil { log.Fatalln(err) } @@ -105,13 +105,13 @@ func main() { return } - password1, err := terminal.ReadPassword(0) + password1, err := term.ReadPassword(0) if err != nil { log.Fatalln(err) } os.Stderr.WriteString("\n") // #nosec G104 os.Stderr.WriteString("Repeat passphrase:") // #nosec G104 - password2, err := terminal.ReadPassword(0) + password2, err := term.ReadPassword(0) if err != nil { log.Fatalln(err) } diff --git a/src/go.mod b/src/go.mod index 1b808cd..87b5152 100644 --- a/src/go.mod +++ b/src/go.mod @@ -12,6 +12,7 @@ require ( golang.org/x/crypto v0.0.0-20201221181555-eec23a3978ad golang.org/x/net v0.0.0-20201224014010-6772e930b67b golang.org/x/sys v0.0.0-20210105210732-16f7687f5001 + golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1 gopkg.in/check.v1 v1.0.0-20200902074654-038fdea0a05b // indirect ) -- 2.44.0