mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
pkg/term/term_linux_test: check returned error before deferring tty.Close() (staticcheck)
Fix the following warnings from staticcheck linter: ``` pkg/term/term_linux_test.go:34:2: SA5001: should check returned error before deferring tty.Close() (staticcheck) defer tty.Close() ^ pkg/term/term_linux_test.go:52:2: SA5001: should check returned error before deferring tty.Close() (staticcheck) defer tty.Close() ^ pkg/term/term_linux_test.go:67:2: SA5001: should check returned error before deferring tty.Close() (staticcheck) defer tty.Close() ^ .... ``` Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com> Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This commit is contained in:
parent
0507c358d9
commit
b5695b8663
1 changed files with 6 additions and 6 deletions
|
@ -31,8 +31,8 @@ func newTempFile() (*os.File, error) {
|
|||
|
||||
func TestGetWinsize(t *testing.T) {
|
||||
tty, err := newTtyForTest(t)
|
||||
defer tty.Close()
|
||||
assert.NilError(t, err)
|
||||
defer tty.Close()
|
||||
winSize, err := GetWinsize(tty.Fd())
|
||||
assert.NilError(t, err)
|
||||
assert.Assert(t, winSize != nil)
|
||||
|
@ -49,8 +49,8 @@ var cmpWinsize = cmp.AllowUnexported(Winsize{})
|
|||
|
||||
func TestSetWinsize(t *testing.T) {
|
||||
tty, err := newTtyForTest(t)
|
||||
defer tty.Close()
|
||||
assert.NilError(t, err)
|
||||
defer tty.Close()
|
||||
winSize, err := GetWinsize(tty.Fd())
|
||||
assert.NilError(t, err)
|
||||
assert.Assert(t, winSize != nil)
|
||||
|
@ -64,8 +64,8 @@ func TestSetWinsize(t *testing.T) {
|
|||
|
||||
func TestGetFdInfo(t *testing.T) {
|
||||
tty, err := newTtyForTest(t)
|
||||
defer tty.Close()
|
||||
assert.NilError(t, err)
|
||||
defer tty.Close()
|
||||
inFd, isTerminal := GetFdInfo(tty)
|
||||
assert.Equal(t, inFd, tty.Fd())
|
||||
assert.Equal(t, isTerminal, true)
|
||||
|
@ -79,8 +79,8 @@ func TestGetFdInfo(t *testing.T) {
|
|||
|
||||
func TestIsTerminal(t *testing.T) {
|
||||
tty, err := newTtyForTest(t)
|
||||
defer tty.Close()
|
||||
assert.NilError(t, err)
|
||||
defer tty.Close()
|
||||
isTerminal := IsTerminal(tty.Fd())
|
||||
assert.Equal(t, isTerminal, true)
|
||||
tmpFile, err := newTempFile()
|
||||
|
@ -92,8 +92,8 @@ func TestIsTerminal(t *testing.T) {
|
|||
|
||||
func TestSaveState(t *testing.T) {
|
||||
tty, err := newTtyForTest(t)
|
||||
defer tty.Close()
|
||||
assert.NilError(t, err)
|
||||
defer tty.Close()
|
||||
state, err := SaveState(tty.Fd())
|
||||
assert.NilError(t, err)
|
||||
assert.Assert(t, state != nil)
|
||||
|
@ -106,8 +106,8 @@ func TestSaveState(t *testing.T) {
|
|||
|
||||
func TestDisableEcho(t *testing.T) {
|
||||
tty, err := newTtyForTest(t)
|
||||
defer tty.Close()
|
||||
assert.NilError(t, err)
|
||||
defer tty.Close()
|
||||
state, err := SetRawTerminal(tty.Fd())
|
||||
defer RestoreTerminal(tty.Fd(), state)
|
||||
assert.NilError(t, err)
|
||||
|
|
Loading…
Reference in a new issue