Write Go files with an internal helper instead of gofiles.Write#222
Open
tabboud wants to merge 1 commit into
Open
Write Go files with an internal helper instead of gofiles.Write#222tabboud wants to merge 1 commit into
tabboud wants to merge 1 commit into
Conversation
nmiyake
reviewed
Oct 17, 2022
nmiyake
left a comment
Contributor
There was a problem hiding this comment.
Based on the fact that this is only file that changes, it seems like this change alone doesn't remove the dependency for gofiles -- is that correct? It feels like this change would make more sense if it removed the gofiles dependency from this module (if not fully/transitively, then at least for direct reference)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Before this PR
A break (no more template rendering) and a behavior change (using packages.Load to get module paths instead of $GOPATH) in nmiyake/pkg/gofiles caused tests to fail on palantir/godel-okgo-asset-importalias#132 since we're no longer writing
go.modfiles.All usages of gofiles.Write did not inspect the returned import paths, so instead of using that function, we can use an internal function to write out the raw Go files avoiding any package loading and only returning errors for writing the files.
This is almost identical to what was done for distgo here: palantir/distgo#237
After this PR
==COMMIT_MSG==
Write Go files with an internal helper instead of gofiles.Write
==COMMIT_MSG==
Possible downsides?