Skip to content

Conversation

@yhakbar
Copy link
Collaborator

@yhakbar yhakbar commented Dec 12, 2025

Description

Replaces usage of utility functions that are supported in the standard library now.

TODOs

Read the Gruntwork contribution guidelines.

  • I authored this code entirely myself
  • I am submitting code based on open source software (e.g. MIT, MPL-2.0, Apache)]
  • I am adding or upgrading a dependency or adapted code and confirm it has a compatible open source license
  • Update the docs.
  • Run the relevant tests successfully, including pre-commit checks.
  • Include release notes. If this PR is backward incompatible, include a migration guide.

Release Notes (draft)

Added / Removed / Updated [X].

Migration Guide

Summary by CodeRabbit

  • Chores
    • Replaced custom list utilities with Go standard library slice operations across the codebase, modernizing internals.
    • Removed redundant internal helpers and updated related tests.
    • No user-facing behavior changes; functionality and public APIs remain the same.

✏️ Tip: You can customize this high-level summary in your review settings.

@vercel
Copy link

vercel bot commented Dec 12, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Preview Comments Updated (UTC)
terragrunt-docs Ready Ready Preview Comment Dec 12, 2025 7:36pm

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Dec 12, 2025

📝 Walkthrough

Walkthrough

This pull request refactors the codebase to use Go's standard library slices package instead of custom utility functions. Specifically, util.ListContainsElement is replaced with slices.Contains and util.ListEquals with slices.Equal across the codebase, with the custom functions then removed from the utility module.

Changes

Cohort / File(s) Summary
Slice containment check replacements
cli/commands/commands.go, config/config.go, config/dependency.go, internal/providercache/provider_cache.go, internal/runner/run/debug.go, internal/runner/run/hook.go, internal/runner/run/run.go, internal/runner/runnerpool/runner.go, internal/view/writer.go, options/options.go, tf/cache/services/provider_cache.go, tf/getproviders/lock.go, tf/run_cmd.go
Replaced util.ListContainsElement(...) calls with slices.Contains(...) across multiple files. Added slices import and removed util import where applicable. No control-flow changes; semantics preserved.
Utility function removal and updates
util/collections.go
Removed exported functions ListEquals and ListContainsElement. Updated internal functions ListContainsSublist and ListHasPrefix to use slices.Equal instead of the removed ListEquals.
Test updates
util/collections_test.go
Replaced util.ListContainsElement and util.ListEquals test calls with slices.Contains and slices.Equal respectively. Added slices import.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~15 minutes

  • Areas requiring attention:
    • Verify all occurrences of util.ListContainsElement have been replaced across the codebase (13 files touched)
    • Confirm slices import is present in all affected files
    • Validate that removed utility function exports (ListEquals, ListContainsElement) are not used elsewhere in the codebase
    • Check that internal usages of ListContainsSublist and ListHasPrefix (which now use slices.Equal internally) work as expected

Possibly related PRs

Pre-merge checks and finishing touches

❌ Failed checks (2 warnings)
Check name Status Explanation Resolution
Description check ⚠️ Warning The description lacks critical details: no issue reference, missing specific release notes content, and the migration guide is empty despite checklist indicating completion. Add issue reference (Fixes #000), provide concrete release notes describing the change, and confirm whether this change requires a migration guide.
Docstring Coverage ⚠️ Warning Docstring coverage is 68.42% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ Passed checks (1 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and concisely describes the primary change: removing custom utility functions and replacing them with standard library equivalents.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch chore/drop-list-contains-element

📜 Recent review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between a5aadd4 and 987de66.

📒 Files selected for processing (2)
  • config/dependency.go (5 hunks)
  • internal/runner/runnerpool/runner.go (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (2)
  • internal/runner/runnerpool/runner.go
  • config/dependency.go
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (4)
  • GitHub Check: codespell / Check Spelling
  • GitHub Check: license_check / License Check
  • GitHub Check: lint / lint
  • GitHub Check: Pull Request has non-contributor approval

Comment @coderabbitai help to get the list of available commands and usage tips.

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