Closed
Description
Hello! We've discussed before whether the pointer wrappers are going to continue to exist or not, but in the case they do, I have another request.
Currently, in Terraform, we have to do this a LOT:
if awsGoObject.StringPointer == nil {
d.Set("thing", "")
} else {
d.Set("thing". *awsGoObject.StringPointer)
}
It would be very helpful if there was a function called ValueOrZero
(the function name we usually use in situations like this). We could write one for every AWS type, but I feel this would be generally useful. The implementation would be something like this for every type:
func (ptr String) ValueOrZero() string {
if ptr == nil {
return ""
}
return *ptr
}