refactor: type check style

This commit is contained in:
naiba 2024-11-23 12:44:47 +08:00
parent 7d04e739e9
commit 21b795732c
3 changed files with 7 additions and 7 deletions

View File

@ -11,6 +11,8 @@ import (
opty "github.com/creack/pty" opty "github.com/creack/pty"
) )
var _ IPty = (*Pty)(nil)
var defaultShells = []string{"zsh", "fish", "bash", "sh"} var defaultShells = []string{"zsh", "fish", "bash", "sh"}
type Pty struct { type Pty struct {
@ -79,5 +81,3 @@ func (pty *Pty) Close() error {
} }
return pty.killChildProcess(pty.cmd) return pty.killChildProcess(pty.cmd)
} }
var _ IPty = &Pty{}

View File

@ -19,6 +19,9 @@ import (
"github.com/shirou/gopsutil/v4/host" "github.com/shirou/gopsutil/v4/host"
) )
var _ IPty = (*winPTY)(nil)
var _ IPty = (*conPty)(nil)
var isWin10 = VersionCheck() var isWin10 = VersionCheck()
type winPTY struct { type winPTY struct {
@ -164,6 +167,3 @@ func (c *conPty) Close() error {
} }
return nil return nil
} }
var _ IPty = &winPTY{}
var _ IPty = &conPty{}

View File

@ -10,6 +10,8 @@ import (
"github.com/UserExistsError/conpty" "github.com/UserExistsError/conpty"
) )
var _ IPty = (*Pty)(nil)
type Pty struct { type Pty struct {
tty *conpty.ConPty tty *conpty.ConPty
} }
@ -61,5 +63,3 @@ func (pty *Pty) Close() error {
} }
return nil return nil
} }
var _ IPty = &Pty{}