How does golang get the underlying type name?

how does golang get the underlying type name?

give an example:

func Hello(w http.ResponseWriter, r *http.Request) {
    io.WriteString(w, "hello")
}

h := http.HandlerFunc(Hello)

http.HandleFunc("/hello", h)

here through reflection h I only get its name HandlerFunc , and I want to get h underlying type name Hello what should I do?

Jun.07,2022

is there any need to do this?

Hello function, compiled to be an address, what do you need the Hello flag for?

so I don't think I can get the Hello logo.

you can strings the compiled program to see if you can get the identifier.


you can get it with the following code:

runtime.FuncForPC(reflect.ValueOf(h).Pointer()).Name()
MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b2be87-2bab6.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b2be87-2bab6.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?