如何使用反射获取字符串指针的变量名?

I want to get the name of a field name by using reflection. I pass the string as a pointer and then I want to retrieve the variable name in the function.

type FooBar struct {
    foo *string
}

func bar(s *string) {

    var name string

    // TODO: Get name of the field that s is pointing to!

    fmt.Println("Expected string is foo: " + name)
}

func main() {
    f := Foo{"bar"}
    bar(f.s)
}

I tried getting the value of s with

val := reflect.ValueOf(s)

and then I am out of my depth to get the variable name.

I should mention that there are multiple fields in my struct and I don't know in advance which field is in question.

Any help is appreciated. Thanks

You cannot do this.

When you write f.s all you have is a pointer to string. The information that some fields in some struct happens to have this as a value is completely lost/unavailable.

I'm not going to recommend package unsafe here: You must redesign.