Anonymous struct is sufficient

This commit is contained in:
Özgür Kesim 2020-05-16 11:12:44 +02:00
parent 89cf49af58
commit b0b2d09871

View File

@ -5,15 +5,14 @@ import (
"unsafe"
)
type winsize struct {
Row uint16
Col uint16
Xpixel uint16
Ypixel uint16
}
func init() {
ws := &winsize{}
ws := &struct {
row uint16
col uint16
xpixel uint16
ypixel uint16
}{}
retCode, _, errno := syscall.Syscall(syscall.SYS_IOCTL,
uintptr(syscall.Stdin),
uintptr(syscall.TIOCGWINSZ),
@ -23,5 +22,5 @@ func init() {
panic(errno)
}
Width = int(ws.Col) - 2
Width = int(ws.col) - 2
}