mitranim / gow

Missing watch mode for Go commands. Watch Go files and execute a command like "go run" or "go test"
The Unlicense
751 stars 29 forks source link

undefined: unix.TIOCGETA #1

Closed wkhere closed 5 years ago

wkhere commented 5 years ago

Hi!

Got your announcement on nuts list, wanted to examine the tool and so far it can't compile:

% go get github.com/Mitranim/gow
# github.com/Mitranim/gow
go/src/github.com/Mitranim/gow/gow.go:344:40: undefined: unix.TIOCGETA
go/src/github.com/Mitranim/gow/gow.go:365:33: undefined: unix.TIOCSETA
go/src/github.com/Mitranim/gow/gow.go:370:34: undefined: unix.TIOCSETA
% go version                                                            
go version go1.11.1 linux/amd64

Wild guess would be that TIOCSETA is "darwinism/bsdism" ;)...

mitranim commented 5 years ago

Glad to see some interest. Just pushed a potential fix. A noob mistake 😅

wkhere commented 5 years ago

Haha and cool to see quick response!

But,

go get -u github.com/Mitranim/gow
# github.com/Mitranim/gow
go/src/github.com/Mitranim/gow/const_bsd.go:5:26: undefined: unix.TIOCGETA
go/src/github.com/Mitranim/gow/const_bsd.go:6:27: undefined: unix.TIOCSETA
go/src/github.com/Mitranim/gow/const_linux.go:5:7: ioctlReadTermios redeclared in this block
    previous declaration at go/src/github.com/Mitranim/gow/const_bsd.go:5:26
go/src/github.com/Mitranim/gow/const_linux.go:6:7: ioctlWriteTermios redeclared in this block
    previous declaration at go/src/github.com/Mitranim/gow/const_bsd.go:6:27

'bsd' is not a valid GOOS, it's separately 'freebsd' & 'darwin', you'd probably need to put explicit // +build ... line for the relevant bsd-descendant OSes (also: dragonfly, netbsd, openbsd, I am not saying they for sure have this constant but they may)

Btw you know that you can crosscompile by yourself with GOOS=linux go build

Also GOOS=... go doc ... will show you different docs for each OS, maybe this is fastest way to verify where your constant really exist.

For me, the last commit a0a93df compiles only for freebsd, not for linux and darwin.

mitranim commented 5 years ago

Yeah I forgot to add the +build pragma. Too twitchy and hopped-up on ☕️. Thanks for the cross-compile tip. Just pushed another fix, GOOS=linux go build works on my system now.

wkhere commented 5 years ago

Ok now got it, thx