Skip to content
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

Merged
merged 11 commits into from
Oct 5, 2023

Conversation

harry-hov
Copy link
Contributor

@harry-hov harry-hov commented Aug 28, 2023

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.

Contributors' checklist...
  • Added new tests, or not needed, or not feasible
  • Provided an example (e.g. screenshot) to aid review or the PR is self-explanatory
  • Updated the official documentation or not needed
  • No breaking changes were made, or a BREAKING CHANGE: xxx message was included in the description
  • Added references to related issues and PRs
  • Provided any useful hints for running manual tests
  • Added new benchmarks to generated graphs, if any. More info here.

@harry-hov harry-hov self-assigned this Aug 28, 2023
@github-actions github-actions bot added the 📦 🤖 gnovm Issues or PRs gnovm related label Aug 28, 2023
@harry-hov harry-hov marked this pull request as ready for review August 28, 2023 10:58
@harry-hov harry-hov requested a review from a team as a code owner August 28, 2023 10:58
@harry-hov harry-hov mentioned this pull request Aug 28, 2023
7 tasks
@moul moul added this to the 💡Someday/Maybe milestone Sep 6, 2023
@harry-hov harry-hov requested a review from a team September 11, 2023 14:27
@harry-hov
Copy link
Contributor Author

harry-hov commented Sep 11, 2023

This PR is required for gno mod tidy support (i.e PR #1035). Since PR #1035 is [🌟 Wanted for Launch].

Changing status from [🔵 Not Needed for Launch] -> [🌟 Wanted for Launch]

Edit: Also modified the milestone

cc: @moul

Copy link
Member

@zivkovicmilos zivkovicmilos left a 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

@harry-hov harry-hov force-pushed the hariom/improv-writetopath branch from 3fb37ff to a6d2dab Compare September 23, 2023 13:59
@codecov
Copy link

codecov bot commented Sep 23, 2023

Codecov Report

Attention: 72 lines in your changes are missing coverage. Please review.

Comparison is base (924d62d) 47.59% compared to head (b9a0805) 47.77%.
Report is 1 commits behind head on master.

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     
Files Coverage Δ
gnovm/cmd/gno/mod.go 80.73% <100.00%> (ø)
gnovm/pkg/gnomod/gnomod.go 69.65% <90.00%> (-2.96%) ⬇️
gnovm/pkg/gnomod/file.go 73.18% <81.57%> (+2.89%) ⬆️
gnovm/pkg/gnomod/read.go 63.59% <58.08%> (+9.91%) ⬆️

... and 19 files with indirect coverage changes

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@moul moul merged commit d865095 into gnolang:master Oct 5, 2023
182 checks passed
gfanton pushed a commit to gfanton/gno that referenced this pull request Nov 9, 2023
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]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
📦 🤖 gnovm Issues or PRs gnovm related
Projects
Status: 🌟 Wanted for Launch
Archived in project
Development

Successfully merging this pull request may close these issues.

3 participants