Skip to content

Instantly share code, notes, and snippets.

@wilinz
Last active October 25, 2023 16:16
Show Gist options
  • Save wilinz/2ce7805d43f9b584669b71c0de8e2431 to your computer and use it in GitHub Desktop.
Save wilinz/2ce7805d43f9b584669b71c0de8e2431 to your computer and use it in GitHub Desktop.
go pointer util
package ptr
func ptr[T any](v T) *T {
return &v
}
func unptr[T any](ptr *T) T {
return *ptr
}
@wilinz
Copy link
Author

wilinz commented Oct 25, 2023

Since Go 1.18

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