Skip to content

chore: Cleanup replace helper functions which does the same as ptr.To() #132749

@PatrickLaabs

Description

@PatrickLaabs

As soon as the Issue #132086 has been solved, we should find and remove left-over helper functions, and replace them with the actual implementation of the ptr package.

Examples:

We do have a few helpers like this:

func strPtr(str string) *string {
	return &str
}

These can be easily replaced by:

ptr.To("XXX")

There are also serveral other helper functions. A few looks like this:

uint64Ptr Helpers already been replaced by @ylink-lfs with PR: #132787

func uint64Ptr(u uint64) *uint64 {
	return &u
}

uint64ptr Helpers already been replaced by @ylink-lfs with PR: #132819

func uint64ptr(i uint64) *uint64 {
	return &i
}

strPtr Helpers already been replaced by @ylink-lfs with the PR: #132788

func strPtr(str string) *string {
	return &str
}

boolPtr Helpers already been replaced by @PatrickLaabs with PR: #132794

func boolPtr(val bool) *bool {
	return &val
}

int64Ptr Helpers already getting replaced by @ylink-lfs with PR: #132845

func int64Ptr(i int64) *int64 {
	return &i
}

@ylink-lfs

func int32Ptr(i int32) *int32 { return &i }

timer ptr getting replaced by @PatrickLaabs with PR: #133030

func ptr(t time.Time) *time.Time {
	return &t
}

toPtr Helpers already been replaced by @PatrickLaabs with PR: #132806

toPtr := func(s string) *string {
		return &s
	}

float64Ptr is getting replaced by @aman4433 with PR: #133104

func float64Ptr(f float64) *float64

This issue shall be tracking issue to replace those helpers overtime - as this might be a long running task aswell.

Metadata

Metadata

Labels

kind/cleanupCategorizes issue or PR as related to cleaning up code, process, or technical debt.needs-triageIndicates an issue or PR lacks a `triage/foo` label and requires one.sig/architectureCategorizes an issue or PR as relevant to SIG Architecture.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions