DEV Community

Cover image for Simple utility function that will make you handle pointers in Go easier

Simple utility function that will make you handle pointers in Go easier

Laba Subagia on February 12, 2024

Using Pointer in Go is sometimes inevitable. One case is when I started to learn how to use Go. At that time, the team was migrating the legacy Nod...
Collapse
 
mikeschinkel profile image
Mike Schinkel

Nice and simple, though I wondered when simple was going to occur while reading the long article. 😁

Of course ValOrElse() is a tortured name; I'd just go with the Value() as with two parameters the Else is really kinda implied.