-
Notifications
You must be signed in to change notification settings - Fork 382
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
feat: use modfile
package to write modfile
#1077
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Essentially the same comment I had about #1078:
#1078 (review)
Please see:
https://app.codecov.io/gh/gnolang/gno/pull/1077
3fb37ff
to
a6d2dab
Compare
Codecov ReportAttention:
Additional details and impacted files@@ Coverage Diff @@
## master #1077 +/- ##
==========================================
+ Coverage 47.59% 47.77% +0.17%
==========================================
Files 369 369
Lines 62505 62710 +205
==========================================
+ Hits 29752 29960 +208
+ Misses 30335 30320 -15
- Partials 2418 2430 +12
☔ View full report in Codecov by Sentry. |
The previous implementation manually iterates over the `Require` and `Replace` and writes them in the string var to construct the modfile, which is very inefficient and doesn't handles comments and other cases. Changed it use `modfile` package to write modfile(gno.mod/go.mod). It uses `*modfile.FileSyntax`. Copied few methods from `modfile` package to manipulate `*modfile.FileSyntax`. <details><summary>Contributors' checklist...</summary> - [x] Added new tests, or not needed, or not feasible - [x] Provided an example (e.g. screenshot) to aid review or the PR is self-explanatory - [x] Updated the official documentation or not needed - [x] No breaking changes were made, or a `BREAKING CHANGE: xxx` message was included in the description - [x] Added references to related issues and PRs - [x] Provided any useful hints for running manual tests - [ ] Added new benchmarks to [generated graphs](https://gnoland.github.io/benchmarks), if any. More info [here](https://github.com/gnolang/gno/blob/master/.benchmarks/README.md). </details> --------- Co-authored-by: Manfred Touron <[email protected]>
The previous implementation manually iterates over the
Require
andReplace
and writes them in the string var to construct the modfile, which is very inefficient and doesn't handles comments and other cases.Changed it use
modfile
package to write modfile(gno.mod/go.mod). It uses*modfile.FileSyntax
. Copied few methods frommodfile
package to manipulate*modfile.FileSyntax
.Contributors' checklist...
BREAKING CHANGE: xxx
message was included in the description