Last active
October 25, 2023 16:16
-
-
Save wilinz/2ce7805d43f9b584669b71c0de8e2431 to your computer and use it in GitHub Desktop.
go pointer util
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package ptr | |
func ptr[T any](v T) *T { | |
return &v | |
} | |
func unptr[T any](ptr *T) T { | |
return *ptr | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Since Go 1.18