summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimão Gomes Viana <devel@superboring.dev>2021-03-29 20:39:08 +0200
committerGitHub <noreply@github.com>2021-03-29 12:39:08 -0600
commit1c8ea0082822fbc13cb6b86443b908f6a068f385 (patch)
tree154befc93b40dcc4b9e5229c62fb1fbd2b7190e0
parentd63d5ae1ceba4591f2837dff7a9e102dff7e89f2 (diff)
go.mod: Migrate to golang.org/x/term (#4073)
golang.org/x/crypto/ssh/terminal is deprecated in favor of golang.org/x/term See https://github.com/caddyserver/caddy/pull/4073/checks?check_run_id=2152150495 Error: SA1019: package golang.org/x/crypto/ssh/terminal is deprecated: this package moved to golang.org/x/term. (staticcheck) See https://github.com/caddyserver/caddy/pull/4073/checks?check_run_id=2152228516 Error: SA1019: package golang.org/x/crypto/ssh/terminal is deprecated: this package moved to golang.org/x/term. (staticcheck) Test: go test -count=1 './...'
-rw-r--r--go.mod1
-rw-r--r--go.sum3
-rw-r--r--logging.go4
-rw-r--r--modules/caddyhttp/caddyauth/command.go12
4 files changed, 12 insertions, 8 deletions
diff --git a/go.mod b/go.mod
index 91f2a19..4e462ab 100644
--- a/go.mod
+++ b/go.mod
@@ -26,6 +26,7 @@ require (
go.uber.org/zap v1.16.0
golang.org/x/crypto v0.0.0-20200728195943-123391ffb6de
golang.org/x/net v0.0.0-20201110031124-69a78807bb2b
+ golang.org/x/term v0.0.0-20210317153231-de623e64d2a6
google.golang.org/genproto v0.0.0-20200806141610-86f49bd18e98
google.golang.org/protobuf v1.24.0 // cannot upgrade until warning is fixed
gopkg.in/natefinch/lumberjack.v2 v2.0.0
diff --git a/go.sum b/go.sum
index 2a292d9..5268b11 100644
--- a/go.sum
+++ b/go.sum
@@ -926,8 +926,11 @@ golang.org/x/sys v0.0.0-20200519105757-fe76b779f299/go.mod h1:h1NjWce9XRLGQEsW7w
golang.org/x/sys v0.0.0-20200615200032-f1bc736245b1/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20200625212154-ddb9806d33ae/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
+golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20201214210602-f9fddec55a1e h1:AyodaIpKjppX+cBfTASF2E1US3H2JFBj920Ot3rtDjs=
golang.org/x/sys v0.0.0-20201214210602-f9fddec55a1e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
+golang.org/x/term v0.0.0-20210317153231-de623e64d2a6 h1:EC6+IGYTjPpRfv9a2b/6Puw0W+hLtAhkV1tPsXhutqs=
+golang.org/x/term v0.0.0-20210317153231-de623e64d2a6/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/text v0.0.0-20170915090833-1cbadb444a80/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
diff --git a/logging.go b/logging.go
index 60ca487..7837145 100644
--- a/logging.go
+++ b/logging.go
@@ -27,7 +27,7 @@ import (
"go.uber.org/zap"
"go.uber.org/zap/zapcore"
- "golang.org/x/crypto/ssh/terminal"
+ "golang.org/x/term"
)
func init() {
@@ -670,7 +670,7 @@ func newDefaultProductionLog() (*defaultCustomLog, error) {
func newDefaultProductionLogEncoder(colorize bool) zapcore.Encoder {
encCfg := zap.NewProductionEncoderConfig()
- if terminal.IsTerminal(int(os.Stdout.Fd())) {
+ if term.IsTerminal(int(os.Stdout.Fd())) {
// if interactive terminal, make output more human-readable by default
encCfg.EncodeTime = func(ts time.Time, encoder zapcore.PrimitiveArrayEncoder) {
encoder.AppendString(ts.UTC().Format("2006/01/02 15:04:05.000"))
diff --git a/modules/caddyhttp/caddyauth/command.go b/modules/caddyhttp/caddyauth/command.go
index a2ae755..597681b 100644
--- a/modules/caddyhttp/caddyauth/command.go
+++ b/modules/caddyhttp/caddyauth/command.go
@@ -25,7 +25,7 @@ import (
"github.com/caddyserver/caddy/v2"
caddycmd "github.com/caddyserver/caddy/v2/cmd"
- "golang.org/x/crypto/ssh/terminal"
+ "golang.org/x/term"
)
func init() {
@@ -67,27 +67,27 @@ func cmdHashPassword(fs caddycmd.Flags) (int, error) {
if len(plaintext) == 0 {
fd := int(os.Stdin.Fd())
- if terminal.IsTerminal(fd) {
+ if term.IsTerminal(fd) {
// ensure the terminal state is restored on SIGINT
- state, _ := terminal.GetState(fd)
+ state, _ := term.GetState(fd)
c := make(chan os.Signal, 1)
signal.Notify(c, os.Interrupt)
go func() {
<-c
- _ = terminal.Restore(fd, state)
+ _ = term.Restore(fd, state)
os.Exit(caddy.ExitCodeFailedStartup)
}()
defer signal.Stop(c)
fmt.Fprint(os.Stderr, "Enter password: ")
- plaintext, err = terminal.ReadPassword(fd)
+ plaintext, err = term.ReadPassword(fd)
fmt.Fprintln(os.Stderr)
if err != nil {
return caddy.ExitCodeFailedStartup, err
}
fmt.Fprint(os.Stderr, "Confirm password: ")
- confirmation, err := terminal.ReadPassword(fd)
+ confirmation, err := term.ReadPassword(fd)
fmt.Fprintln(os.Stderr)
if err != nil {
return caddy.ExitCodeFailedStartup, err