Skip to content

Add NewPtrOr

Latest
Compare
Choose a tag to compare
@Southclaws Southclaws released this 30 Jan 14:41

NewPtrOr allows you to fall back to a concrete value if the pointer was nil.

d := NewPtrOr(description, "(no description)")
// if "description" was set, d contains the value
// if "description" was nil, d "(no description)"

Full Changelog: v0.6.0...v0.6.1