Skip to content

refactor: use slices.Contains #185

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

Merged
merged 1 commit into from
Jun 6, 2025
Merged

refactor: use slices.Contains #185

merged 1 commit into from
Jun 6, 2025

Conversation

cuishuang
Copy link
Contributor

use go run golang.org/x/tools/gopls/internal/analysis/modernize/cmd/modernize@latest -fix -test ./... to make the code more modern and easy to read.

Copy link
Collaborator

@jmr jmr left a comment

Choose a reason for hiding this comment

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

Is the performance the same? Are there any benchmarks that cover this code?

@cuishuang
Copy link
Contributor Author

Is the performance the same? Are there any benchmarks that cover this code?

The performance shouldn't differ too much, as the purpose of the Go toolchain team adding this utility is to replace the usage of slices.Contains and similar functions.

However, the specific performance may still depend on the size of the slice elements and whether the target element exists.

@jmr jmr merged commit e8fe6a7 into golang:master Jun 6, 2025
5 checks passed
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.

2 participants