After introducing Go 1.18 to a project, it's required by law to convert at least one method to a generic one. Everyone hates IntToPtr, StringToPtr, BoolToPtr and Uint64ToPtr, so let's convert them to the ultimate generic ToPtr one. Signed-off-by: Ondřej Budai <ondrej@budai.cz>
5 lines
57 B
Go
5 lines
57 B
Go
package common
|
|
|
|
func ToPtr[T any](x T) *T {
|
|
return &x
|
|
}
|