A pointer utilities for golang.
before:
func TakeReferenceFunc(s *string) {
value = "fuga"
if s != nil {
value = *s
}
fmt.Println(value)
}
func main() {
tmp := "hoge"
TakeReferenceFunc(&tmp)
}
after:
func TakeReferenceFunc(s *string) {
fmt.Println(ptr.DerefString(s, "fuga"))
}
func main() {
TakeReferenceFunc(ptr.RefString("hoge"))
}