How to convert a 'string pointer' to a string in Golang?
Solution 1:
Dereference the pointer:
strPointerValue := *strPointer
Solution 2:
A simple function that first checks if the string pointer is nil would prevent runtime errors:
func DerefString(s *string) string {
if s != nil {
return *s
}
return ""
}