-
Notifications
You must be signed in to change notification settings - Fork 17.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
cmd/go: support passing @args-file to -toolexec commands #70046
Comments
As suggested by @gabyhelp, this is actually very much related to (although this has the added characteristic of being an apparent |
Also, the culprit is likely this code path: go/src/cmd/go/internal/work/exec.go Lines 3431 to 3435 in e5e552b
Since in our case, the |
-toolexec
on Windows
It's fair to say that most Unix programs do not understand the Do most Windows programs understand that syntax? |
I agree - this could be surprising to a bunch of tools; although... On Windows specifically, if the CLI arguments exceed 32KiB, then the command will basically just not run... It'll just fail differently if you pass a response file instead of the arguments list in that case... But regardless; I think it would be a-okay (to me at least) to either have:
It might also be relevant to document the syntax of these files publicly so that it feels less like copying CLI implementation details (apparently it supports line continuations, the response file can contain further response files, etc...) An alternative to the "new flag" or "special syntax" solutions mentioned above would be to enact feature negociation between the go toolchain & the downstream tools... The toolchain already invokes all tools with
One advantage to this approach is it removes the need for the command allow-list, and more commands cand eclare their support for this feature by just implementing it... It also allows Obviously this is not exempt from issues either (is adding more content to the output of The
The idea here being that tools that were created before introduction of this mechanism would simply forward arguments to the |
I will add that today, if the In addition to this, I would say that today, any change to any tool's arguments could be seen as a breaking change for From this perspective, whether sending the |
That is what I have been assuming with my own development of toolexec tools. FWIW I already wrote generic response file support in Go at https://pkg.go.dev/mvdan.cc/responsefile, and you're welcome to reuse it as well. |
I would have made the same assumption. I'm wondering if there are any tools that already exist that examine the arguments passed in used in workflows that would break if we decided to start passing in response file arguments? |
I don't think any toolexec tools written today would handle @-arg response files, because they simply have never been supplied before. But those same tools are already pretty broken today when very many files are being built at once, e.g. burrowers/garble#572, so I think we need to cross this bridge sooner or later. |
Go version
go version go1.23.2 linux/arm64
Output of
go env
in your module/workspace:What did you do?
The following command works as intended:
$ go build -a github.com/elastic/go-elasticsearch/v8/typedapi/types
However if you use any
-toolexec
value, it suddenly fails on Windows:This is because the
github.com/elastic/go-elasticsearch/v8/typedapi/types
package contains a metric ton of files, and results in an excessively long command line for Windows.What did you see happen?
What we observe is that when there is no
-toolexec
the Windows arguments size limit (of 32KiB) is "worked around" by passing an@args-file
value that contains all the arguments instead of passing the arguments list itself directly...Unfortunately, the use of
-toolexec
appears to disable this mechanism, making it impossible to build packages with very large amounts of files in them on Windows.I have verified this behavior using
strace
on a Linux machine... I expect the same behavior happens on Windows as well and explains our issue here...What did you expect to see?
I expect a package that successfully builds without
-toolexec
to also be build-able with-toolexec
, and for the-toolexec
tool to actually also receive the arguments file stand-in when appropriate.The text was updated successfully, but these errors were encountered: