Skip to content

[REFACTOR] Remove custom contains in favor of std lib impl #194

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

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

bashhack
Copy link

What type of PR is this? (check all applicable)

  • Refactor
  • Feature
  • Bug Fix
  • Optimization
  • Documentation Update
  • Go Version Update
  • Dependency Update

Description

Replace custom contains helper function with standard library's slices.Contains

Changes

  • Removed custom contains() function from helpers.go
  • Updated csrf.go to use slices.Contains() instead
  • All tests pass successfully

Rationale

This simplifies the codebase by leveraging Go's standard library instead of maintaining a custom implementation. Both have O(n) complexity, so there's no performance impact.

Related Tickets & Documents

N/A

Added/updated tests?

  • Yes
  • No, and this is why:
    • Changes made simplify long-term maintenance, without altering core application logic
  • I need help with writing tests

Run verifications and test

  • make verify is passing

⚠️ NOTE: Per contributing guidelines, make verify should be run before PR submission, in running this I noticed failures unrelated to my changes - so while I'm here and since I'm dealing with strings lib changes, I've gone ahead and addressed - though out of scope from my intended change, I hope you don't mind

  • make test is passing

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

Successfully merging this pull request may close these issues.

1 participant