mitranim / gow

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

No Windows support? #6

Open Altiano opened 4 years ago

Altiano commented 4 years ago

got this when installing on Windows 10

$ go get -u github.com/mitranim/gow
# github.com/mitranim/gow
..\..\..\go\src\github.com\mitranim\gow\gow.go:97:15: undefined: unix.Termios
..\..\..\go\src\github.com\mitranim\gow\gow.go:138:31: cannot use syscall.Stdin (type syscall.Handle) as type int in argument to makeTerminalRaw
..\..\..\go\src\github.com\mitranim\gow\gow.go:234:10: undefined: syscall.Kill
..\..\..\go\src\github.com\mitranim\gow\gow.go:239:10: undefined: syscall.SIGCHLD
..\..\..\go\src\github.com\mitranim\gow\gow.go:242:10: undefined: syscall.SIGWINCH
..\..\..\go\src\github.com\mitranim\gow\gow.go:271:7: undefined: syscall.Kill
..\..\..\go\src\github.com\mitranim\gow\gow.go:277:7: undefined: syscall.Kill
..\..\..\go\src\github.com\mitranim\gow\gow.go:291:7: undefined: syscall.Kill
..\..\..\go\src\github.com\mitranim\gow\gow.go:342:31: undefined: unix.Termios
..\..\..\go\src\github.com\mitranim\gow\gow.go:368:38: undefined: unix.Termios
..\..\..\go\src\github.com\mitranim\gow\gow.go:291:7: too many errors
mitranim commented 4 years ago

My apologies, gow is currently implemented only for Unix. The core feature, watching the files and rerunning a go command, could work on any OS. The reason for this limitation is the hotkeys feature. It's implemented by switching the terminal to "raw mode" which allows the foreground program (gow) to receive and interpret special control signals sent by hotkeys such as Ctrl+R, which would normally be intercepted and interpreted by the terminal emulator app. Switching to raw mode uses special Unix syscalls. This might be possible on Windows, but I never checked. My recommendation for working on Windows would be to use WSL (Windows subsystem for Linux), because go commands in general are Unix-biased and perform much slower without WSL. gow should also work under WSL.

If there was enough demand for pure Windows support, it would be possible to add. In the limit case, gow could be compiled for Windows without the hotkeys feature.

mitranim commented 3 years ago

Tested and it does work under WSL. That's my recommendation for working with Go anyway. Last time I checked, go commands performed much better with WSL than without it.