X Tutup
Skip to content

Commit b586d51

Browse files
committed
Use golang.org/x/term
The golang.org/x/crypto/ssh/terminal package is deprecated and merely a wrapper around golang.org/x/term. Use the latter directly.
1 parent 9436990 commit b586d51

File tree

4 files changed

+7
-4
lines changed

4 files changed

+7
-4
lines changed

go.mod

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ require (
3333
golang.org/x/crypto v0.0.0-20201016220609-9e8e0b390897
3434
golang.org/x/sync v0.0.0-20190423024810-112230192c58
3535
golang.org/x/sys v0.0.0-20210330210617-4fbd30eecc44
36+
golang.org/x/term v0.0.0-20210422114643-f5beecf764ed
3637
golang.org/x/text v0.3.4 // indirect
3738
gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b
3839
)

go.sum

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -357,6 +357,8 @@ golang.org/x/sys v0.0.0-20210319071255-635bc2c9138d/go.mod h1:h1NjWce9XRLGQEsW7w
357357
golang.org/x/sys v0.0.0-20210330210617-4fbd30eecc44 h1:Bli41pIlzTzf3KEY06n+xnzK/BESIg2ze4Pgfh/aI8c=
358358
golang.org/x/sys v0.0.0-20210330210617-4fbd30eecc44/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
359359
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
360+
golang.org/x/term v0.0.0-20210422114643-f5beecf764ed h1:Ei4bQjjpYUsS4efOUz+5Nz++IVkHk87n2zBA0NxBWc0=
361+
golang.org/x/term v0.0.0-20210422114643-f5beecf764ed/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
360362
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
361363
golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
362364
golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk=

pkg/iostreams/iostreams.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ import (
1717
"github.com/mattn/go-colorable"
1818
"github.com/mattn/go-isatty"
1919
"github.com/muesli/termenv"
20-
"golang.org/x/crypto/ssh/terminal"
20+
"golang.org/x/term"
2121
)
2222

2323
type IOStreams struct {
@@ -332,7 +332,7 @@ func isCygwinTerminal(w io.Writer) bool {
332332

333333
func terminalSize(w io.Writer) (int, int, error) {
334334
if f, isFile := w.(*os.File); isFile {
335-
return terminal.GetSize(int(f.Fd()))
335+
return term.GetSize(int(f.Fd()))
336336
}
337337
return 0, 0, fmt.Errorf("%v is not a file", w)
338338
}

utils/terminal.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import (
55
"os"
66

77
"github.com/mattn/go-isatty"
8-
"golang.org/x/crypto/ssh/terminal"
8+
"golang.org/x/term"
99
)
1010

1111
var IsTerminal = func(f *os.File) bool {
@@ -18,7 +18,7 @@ func IsCygwinTerminal(f *os.File) bool {
1818

1919
var TerminalSize = func(w interface{}) (int, int, error) {
2020
if f, isFile := w.(*os.File); isFile {
21-
return terminal.GetSize(int(f.Fd()))
21+
return term.GetSize(int(f.Fd()))
2222
}
2323

2424
return 0, 0, fmt.Errorf("%v is not a file", w)

0 commit comments

Comments
 (0)
X Tutup