switch to x/term

This commit is contained in:
Aaron Bieber 2021-03-28 14:28:58 -06:00
parent e90e928943
commit e87798cefd
2 changed files with 5 additions and 5 deletions

2
go.mod
View File

@ -9,6 +9,6 @@ require (
golang.org/x/crypto v0.0.0-20210322153248-0c34fe9e7dc2
golang.org/x/net v0.0.0-20210326220855-61e056675ecf
golang.org/x/sys v0.0.0-20210326220804-49726bf1d181 // indirect
golang.org/x/term v0.0.0-20210317153231-de623e64d2a6 // indirect
golang.org/x/term v0.0.0-20210317153231-de623e64d2a6
suah.dev/protect v1.0.0
)

View File

@ -3,17 +3,17 @@ package main
import (
"os"
"golang.org/x/crypto/ssh/terminal"
"golang.org/x/term"
)
//noinspection GoUnresolvedReference
func prompt(p string) (string, error) {
oldState, err := terminal.MakeRaw(0)
oldState, err := term.MakeRaw(0)
if err != nil {
panic(err)
}
defer terminal.Restore(0, oldState)
defer term.Restore(0, oldState)
t := terminal.NewTerminal(os.Stdin, p)
t := term.NewTerminal(os.Stdin, p)
return t.ReadPassword(p)
}