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: access $WORK directory from toolexec #45864
Comments
This is possible today, without directly knowing $WORK. You just look at the compiler flags when it runs, and swap or modify the importcfg file. https://github.com/burrowers/garble/blob/d34406d83279978529dd732ad59e07e867f68c95/main.go#L859-L866 https://github.com/burrowers/garble/blob/d34406d83279978529dd732ad59e07e867f68c95/main.go#L1413 I'm not opposed to exposing $WORK, but I don't think it's necessary for what you want here. |
Actually i need to read the content of the "old" importcfg file and add there some new packagefile directive, so i need to access the old file not only swap it |
Right. The code I shared shows a working example of reading the existing file and replacing it with a new one. |
Imo another option is to allow multiple -importcfg switch and just merge them at compile time |
I guess that's possible, but I don't see it as necessary. I also don't understand how it's related to your original request for $WORK. You can certainly read, modify, and replace |
@dzonerzy I shared details (and even code!) about how this is possible with just a little bit of code today. Can you clarify whether it works for you or not? If it does not, please provide details to keep the issue open for further discussion. |
Your code solved my issue |
What version of Go are you using (
go version
)?Does this issue reproduce with the latest release?
What operating system and processor architecture are you using (
go env
)?go env
OutputWhat did you do?
I'm trying to access $WORK variable via the -toolexec command , in order to modify the content of -importcfg before the compilation of a package
What did you expect to see?
A way to modify -importcfg content before compilation
What did you see instead?
There's not way to access the working directory via -toolexec
The text was updated successfully, but these errors were encountered: