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

refactor: replace experimental libraries with their std versions #1620

Merged
merged 2 commits into from
Mar 3, 2025

Conversation

G-Rath
Copy link
Collaborator

@G-Rath G-Rath commented Feb 13, 2025

These became stable in Go v1.21, so we can stop using the x/exp versions

(this will be enforced by the expotostd linter which is being introduced in the next version of golanglint-ci)

@cuixq
Copy link
Contributor

cuixq commented Feb 14, 2025

@G-Rath I think some tests break due to this change - can you help to fix?

@G-Rath G-Rath force-pushed the lint/replace-exp-libs branch 4 times, most recently from 4f6cc2c to 07924ad Compare February 18, 2025 01:06
@codecov-commenter
Copy link

codecov-commenter commented Feb 18, 2025

Codecov Report

Attention: Patch coverage is 75.00000% with 3 lines in your changes missing coverage. Please review.

Project coverage is 64.60%. Comparing base (caaabe2) to head (93546ec).
Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
cmd/osv-scanner/fix/state-relock-result.go 0.00% 2 Missing ⚠️
scripts/generate_mock_resolution_universe/main.go 0.00% 1 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##             main    #1620   +/-   ##
=======================================
  Coverage   64.60%   64.60%           
=======================================
  Files         156      156           
  Lines       16014    16014           
=======================================
  Hits        10346    10346           
  Misses       4986     4986           
  Partials      682      682           

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

@G-Rath G-Rath force-pushed the lint/replace-exp-libs branch from 22a42de to 3ec88e0 Compare February 24, 2025 23:12
@@ -423,7 +423,7 @@ func makeResultVuln(vuln resolution.Vulnerability) vulnOutput {
vk := sg.Nodes[sg.Dependency].Version
affected[packageOutput{Name: vk.Name, Version: vk.Version}] = struct{}{}
}
v.Packages = slices.Collect(maps.Keys(affected))
v.Packages = slices.AppendSeq(make([]packageOutput, 0, len(affected)), maps.Keys(affected))
Copy link
Collaborator

Choose a reason for hiding this comment

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

Is this needed? It seems weird the .Collect doesn't reallocate slices.

Even if it does not, I think it is better to stick with Collect here until we see that this causes a performance problem just for code clarity

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Apparently using slices.AppendSeq is the "simplest true equivalent", and there is a performance difference.

It doesn't look like there's much difference between slices.Collect though, so I'm not fussed - I can do some benchmarking later too

@G-Rath G-Rath force-pushed the lint/replace-exp-libs branch 2 times, most recently from 88c4e55 to 7923b1d Compare February 27, 2025 19:03
@G-Rath G-Rath force-pushed the lint/replace-exp-libs branch from 7923b1d to 93546ec Compare March 3, 2025 01:16
@another-rex another-rex merged commit 3136799 into google:main Mar 3, 2025
13 checks passed
@another-rex another-rex deleted the lint/replace-exp-libs branch March 3, 2025 03:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants