How to use go-task effectively on windows? #735
-
I was initially attracted to use go-task in preference to makefiles for its ease of use and for its platform independence. In the getting started section, I see this: "Task uses github.com/mvdan/sh, a native Go sh interpreter. So you can write sh/bash commands and it will work even on Windows, where sh or bash are usually not available. Just remember any executable called must be available by the OS or in PATH." But this requirement for all commands (typically they would be all the common shell commands for working with the filesystem) to be present in PATH only applies on non windows systems. On windows, PowerShell is king and non of those commands are in PATH. This is a problem because there is no way as far as I can see so far to write an effective 'clean' task that works on windows: clean:
cmds:
- rm {{.BINARY_NAME}}{{.BINARY_EXT}} fails with:
In windows powershell, "rm" is aliased to Remove-Item a powershell command, but go-task can not invoke this. The same would apply to a plethora of other shell commands that can easily be invoked on x-systems but not on wndows. So what, if any, is the effective way to use go-task on windows without using Linux in WSL, because still I need to build for windows as well as linux/mac. My only other alternative is to use Linux/WSL and hope that I can build windows artefacts from there, but I thought I raise this question to see if there is anything I'm missing. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
This was answered on the Discord channel. I'll just copy the response here in case anyone else have the same doubt. There are some old issues opened with the intention of make more builtins available via the interpreter to improve support to Windows:
This is a very time demanding work, though, and most users use Linux & macOS, so this end up being always delayed. I still hope to address it some day, but I can't promise it'll be soon. As a workaround, you could use an alternative shell locally that include these commands, like Git Bash, or install these binaries manually as there are some projects out there that implemented these commands in Go or Rust, for example. |
Beta Was this translation helpful? Give feedback.
This was answered on the Discord channel. I'll just copy the response here in case anyone else have the same doubt.
There are some old issues opened with the intention of make more builtins available via the interpreter to improve support to Windows:
This is a very time demanding work, though, and most users use Linux & macOS, so this end up being always delayed. I still hope to address it some day, but I can't promise it'll be soon.
As a workaround, you could use an alternative shell locally that include these commands, like Git Bash, or install these binaries manually as there are some projects out there that implemented these commands in Go or Rust, for …