Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Right now,
-w
(write-decls-and-statements) is only used when gomacro is called with file arguments. But it might be useful to save a record of what was run for interactive mode as well. For instance, you might want to play around with some code interactively, save the results, and then use that as the basis of writing a script.This PR makes it so
-w
is respected when run as a REPL. In the existing (file-based) usage, the output of-w
is based on the filename. For the new, REPL case there's nothing to base the ouptut filename on, so I just hard-code a name.Test plan:
I ran the following:
which shows that the declarations are being saved and emitted as expected.