Skip to content

refactor: switch to reusable pointer in utils package #1749

@LeonLow97

Description

@LeonLow97

Is your feature request related to a problem? Please describe.

Not a problem, just adhering to clean code practices.
In my previous PR, I created a reusable ToPtr in utils package using golang generics in pkg/utils/utils.go directory. However, I noticed there is another ptr function that does the same thing in random directories:

  • apis/fluentbit/v1alpha2/filter_types_test.go
  • apis/fluentbit/v1alpha2/plugins/output/influxdb_types_test.go

and many different test files are relying on this function. It's a better practice to use this generic function from utils package that is to be shared by all other files from different packages.

Describe the solution you'd like

Refactor existing test files to use utils.ToPtr from the utils package, replacing all local ptr helper definitions.

Additional context

This will reduce code duplication and improve maintainability across test files.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions