Skip to content

refactor(aws/recs): change RecommendationParams pass-by-value to pointer in SP parser functions #1272

Closed

Description

@cristim

Problem

5 functions in providers/aws/recommendations/parser_sp.go take params common.RecommendationParams by value. RecommendationParams is ~200 bytes (5 string fields + 5 slice fields), triggering gocritic hugeParam warnings. These functions are all read-only users of params.

Affected functions

  • getSavingsPlansRecommendations
  • fetchSPAllPages
  • parseSavingsPlansRecommendations
  • parseSavingsPlanDetail
  • planTypesForParams

Fix

Change each to accept params *common.RecommendationParams (pointer) and update all callers, including test files. Also audit coverage.go and utilization.go for the same pattern.

Deferred from PR #865 to keep scope focused on the race fix. Currently suppressed with //nolint:gocritic comments.

Notes

  • All callers currently pass params by value (local variable), so the change is mechanical
  • No semantic change; read-only pointer access is equivalent

Activity

  1. cristim commented on Jul 27, 2026

    @cristim
    MemberAuthor

    Verification sweep against main (101f099fb) on 2026-07-27 finds this already resolved.
    parser_sp.go: all five functions now take params *common.RecommendationParams.
    Evidence: providers/aws/recommendations/parser_sp.go.
    Recommending close.

  2. cristim commented on Sep 2, 2026

    @cristim
    MemberAuthor

    Verified resolved at 3c0f8ac: getSavingsPlansRecommendations, fetchSPAllPages, parseSavingsPlansRecommendations, parseSavingsPlanDetail and planTypesForParams all take params *common.RecommendationParams, and the //nolint:gocritic suppressions are gone. Evidence: providers/aws/recommendations/parser_sp.go:31,94,170,298,408 (1d9f1b8, PR #865). Residual axes checked: coverage.go and utilization.go were audited as the issue asked and carry no RecommendationParams parameter at all; parser_ri.go:18,44 still pass by value, but those two functions are outside this issue's stated scope and are worth a separate issue if the hugeParam class is being swept. Closing as completed; reopen if the behaviour recurs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions