Warn about Pwsh quoting of Go commands arguments on Windows
I had the bad experience that this doesn't work on Windows:
- name: Run coverage
run: go test -v -race -coverprofile=coverage.out -covermode=atomic ./...
Output:
no required module provides package .out; to add it:
go get .out
Error: Process completed with exit code 1.
But this works:
- name: Run coverage
run: go test -v -race -coverprofile coverage.out -covermode atomic ./...
The only difference is that = is replaced with space.
I suspect this is a PowerShell quoting issue.
That is... interesting. When we add the warning, it would be good to also link to some docs explaining how the Powershell syntax conflicts with very simple POSIX shell without expansions or quoting.
So far I found no document to confirm my hypothesis.
I only have experimental results:
Those two pages from the PowerShell documentation don't mention something special about - args.
(the second one tells about --% that allows to block processing of the rest of the command line, but I don' see how it could be used to have portable commands shared between Unix and Windows).
Nothing mentioned about = in the About parameters page either.
In fact the default shell on Windows is Pwsh (Powershell Core).
https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun
--% works (on Windows):
- name: Run coverage
run: go --% test -v -race -coverprofile=coverage.out -covermode=atomic ./...