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: Add the stdlib_diff tool to compare gno and go standard libraries #2869

Open
wants to merge 23 commits into
base: master
Choose a base branch
from

Conversation

Villaquiranm
Copy link
Contributor

@Villaquiranm Villaquiranm commented Sep 29, 2024

continuing the work started on #1425
thanks FloRichardAloeCorp for the great job on this issue 👍
closes #1310

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.

@Villaquiranm Villaquiranm requested a review from a team as a code owner September 29, 2024 10:54
@Villaquiranm Villaquiranm requested review from ajnavarro and zivkovicmilos and removed request for a team September 29, 2024 10:54
@Villaquiranm Villaquiranm changed the title Feat/stdlib diff feat: Add the stdlib_diff tool to compare gno and go standard libraries #1425 Sep 29, 2024
@Villaquiranm Villaquiranm changed the title feat: Add the stdlib_diff tool to compare gno and go standard libraries #1425 feat: Add the stdlib_diff tool to compare gno and go standard libraries Sep 29, 2024
Copy link

codecov bot commented Sep 29, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 60.91%. Comparing base (69400d4) to head (eaf6a87).

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #2869   +/-   ##
=======================================
  Coverage   60.90%   60.91%           
=======================================
  Files         564      564           
  Lines       75273    75273           
=======================================
+ Hits        45844    45851    +7     
+ Misses      26057    26052    -5     
+ Partials     3372     3370    -2     
Flag Coverage Δ
contribs/gnodev 61.46% <ø> (ø)
contribs/gnofaucet 14.46% <ø> (ø)
gno.land 67.17% <ø> (ø)
gnovm 65.77% <ø> (ø)
misc/genstd 80.54% <ø> (ø)
misc/logos 19.88% <ø> (ø)
tm2 62.05% <ø> (-0.02%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

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

package main

import (
"slices"
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thehowl on Dec 13, 2023
seeing as you are importing slices, please add a go.mod file in this directory putting the go version at go 1.21

fixed on eaf6a87

return len(p.SrcFiles) == len(p.DstFiles)
}

// listDirFiles returns a list of file names in the specified directory.
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thehowl on Dec 13, 2023
Prefer os.ReadDir

fixed on eaf6a87

@Villaquiranm
Copy link
Contributor Author

@thehowl I took a look of this, the current status:
1- Not done yet
2- I think it is already done, I can select the code and the + & - are not selected
3- I was thinking on implementing this using semaphores ? like that I could have the entire code on the same file as it is right now. If you think is necessary to use channels I could do that too.

4 and 5 are fixed on eaf6a87
Only for 4 I think there are some folder we should avoid ? For exemple cmd & vendor as they have a lot of files and I think they are not related to standard lib ?

Thank you for your contribution!

Sorry for the wait, this is an initial to improve. Nice work, but you can improve.

Some functionality missing on the generated report:

1- Formatting is still very funky. Use CSS to render tabs correctly; they should render as 4 spaces.

image

2- Ideally, for the added/deleted lines, make the + and - symbols non selectable. This makes it so that if I select the lines in either side of the page I can copy and paste the code without copying the symbols.

3- I believe the report's performance could be improved. Consider using the library I mention in the comments (diffmatchpatch) and parallelizing execution. You can parallelize execution by having a goroutine trying to first of all find all of the directories in the source and destination, and then sending off to a channel individual package names.

4- The tool does not currently perform diffing recursively. Ie. creating the report on my stdlibs it does not generate a diff for package regexp/syntax. Consider searching using something like filepath.WalkDir.

5- On the report, please make the lines which are == greyed out (putting css opacity: 0.75 probably works)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: No status
Status: Triage
Development

Successfully merging this pull request may close these issues.

Tool for comparing source code of standard libaries between Go and Gno
2 participants