diff options
author | Tobias Klauser <tklauser@distanz.ch> | 2021-03-25 21:26:18 +0100 |
---|---|---|
committer | Tobias Klauser <tobias.klauser@gmail.com> | 2021-03-26 06:03:20 +0000 |
commit | 98a902323f6406d39c068d60253a0872364041ac (patch) | |
tree | 4c2ecb9926469795d13e739ada4e6464a2380129 /src/cmd/pprof | |
parent | 3a0061822e0bfa79f2a464807e12970f588e3e94 (diff) | |
download | go-git-98a902323f6406d39c068d60253a0872364041ac.tar.gz |
cmd/vendor, cmd/pprof: use golang.org/x/term directly
The cmd/pprof package currently uses golang.org/x/crypto/ssh/terminal
which - as of CL 258003 - is merely a wrapper around golang.org/x/term.
Thus, drop the dependency on golang.org/x/crypto/ssh/terminal and use
golang.org/x/term directly.
Change-Id: Ib15f1f110c338b9dba4a91a873171948ae6298a4
Reviewed-on: https://go-review.googlesource.com/c/go/+/304691
Trust: Tobias Klauser <tobias.klauser@gmail.com>
Run-TryBot: Bryan C. Mills <bcmills@google.com>
Reviewed-by: Bryan C. Mills <bcmills@google.com>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Diffstat (limited to 'src/cmd/pprof')
-rw-r--r-- | src/cmd/pprof/readlineui.go | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/src/cmd/pprof/readlineui.go b/src/cmd/pprof/readlineui.go index dbbb9c2787..f46e934e0f 100644 --- a/src/cmd/pprof/readlineui.go +++ b/src/cmd/pprof/readlineui.go @@ -19,7 +19,7 @@ import ( "strings" "github.com/google/pprof/driver" - "golang.org/x/crypto/ssh/terminal" + "golang.org/x/term" ) func init() { @@ -27,11 +27,11 @@ func init() { } // readlineUI implements driver.UI interface using the -// golang.org/x/crypto/ssh/terminal package. +// golang.org/x/term package. // The upstream pprof command implements the same functionality // using the github.com/chzyer/readline package. type readlineUI struct { - term *terminal.Terminal + term *term.Terminal } func newReadlineUI() driver.UI { @@ -39,19 +39,19 @@ func newReadlineUI() driver.UI { if v := strings.ToLower(os.Getenv("TERM")); v == "" || v == "dumb" { return nil } - // test if we can use terminal.ReadLine + // test if we can use term.ReadLine // that assumes operation in the raw mode. - oldState, err := terminal.MakeRaw(0) + oldState, err := term.MakeRaw(0) if err != nil { return nil } - terminal.Restore(0, oldState) + term.Restore(0, oldState) rw := struct { io.Reader io.Writer }{os.Stdin, os.Stderr} - return &readlineUI{term: terminal.NewTerminal(rw, "")} + return &readlineUI{term: term.NewTerminal(rw, "")} } // Read returns a line of text (a command) read from the user. @@ -61,8 +61,8 @@ func (r *readlineUI) ReadLine(prompt string) (string, error) { // skip error checking because we tested it // when creating this readlineUI initially. - oldState, _ := terminal.MakeRaw(0) - defer terminal.Restore(0, oldState) + oldState, _ := term.MakeRaw(0) + defer term.Restore(0, oldState) s, err := r.term.ReadLine() return s, err @@ -106,7 +106,7 @@ func colorize(msg string) string { // interactive terminal (as opposed to being redirected to a file). func (r *readlineUI) IsTerminal() bool { const stdout = 1 - return terminal.IsTerminal(stdout) + return term.IsTerminal(stdout) } // WantBrowser indicates whether browser should be opened with the -http option. |