Go 1.18 introduced ValOrDefault, which helps initialize default values in a configuration struct. It provides a more concise and readable way to set defaults compared to traditional conditionals. However, in Go 1.22, the built-in cmp.Or is recommended as a preferred alternative to ValOrDefault.
•3m read time• From brandur.org
Sort: