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
gomacro/fast: spurious '-quickchecks' flag leaks into user program #94
Comments
I suspect this is coming from (transitively) importing |
Yes, it's an unwanted side effect of gomacro interpreter pre-importing all packages of Go standard library. In particular, the "guilty" package is var defaultMaxCount *int = flag.Int("quickchecks", 100, "The default number of iterations for each check") It seems that package |
yes, removing it fixes it. |
In theory you can add/remove imported packages from the global variable If I understand correctly, what you ask amounts to changing at runtime the list of (transitively) imported packages of a compiled Go program - that's not possible: it is fixed at compile-time for any Go program. |
by opt-in I mean that, rather than pre-importing all the packages from the stdlib, have the consumer of the would that break things in |
That's what I wrote above, perhaps not explicitly enough: not pre-importing all the packages from stdlib it's possible: Instead there is currently no mechanism to blacklist or whitelist which packages can be imported at runtime: Clearly, such a blacklist or whitelist mechanism could be added. |
would it be acceptable to empty out
|
I'd say yes, it's acceptable. One possible unwanted side effect is that a program currently using A little bikeshedding: I'd omit the 'stdlib/' part from the paths. |
I'd be willing to work on this (also b/c right now, gomacro blows up the size of my binaries, see go-hep/hep#700). it seems most of the code under |
It's some time since I last regenerated them, and the procedure is undocumented :( In theory you could move the files to different directories, but you'd also need to change some lines: at least the If you feel adventurous, the generated files are created as a side-effect of executing import _b "PKG/FULL/PATH" at REPL, and you can find the corresponding code in For the above to work, you must first remove the "offending" Go files from |
with gomacro@30b9859a00de, using this simple program:
I get:
could
-quickchecks
be removed as a side effect of importinggomacro/fast
?thanks.
The text was updated successfully, but these errors were encountered: