using reflection in Go to get the name of a struct
<p>I found this question with this great answers:</p>

<p><a href="https://stackoverflow.com/questions/20170275/how-to-find-a-type-of-a-object-in-golang">How to find a type of a object in Golang?</a></p>

<p>I played around with the answer and tried to get the name of a struct in the same way:</p>

<pre><code>package main

import (
        "fmt"
        "reflect"
)

type Ab struct {

}

func getType(myvar interface{}) string {
        return reflect.TypeOf(myvar).Name()
}

func main() {
        fmt.Println("Hello, playground")

        tst := "string"
        tst2 := 10
        tst3 := 1.2
        tst4 := new(Ab)

        fmt.Println(getType(tst))
        fmt.Println(getType(tst2))
        fmt.Println(getType(tst3))
        fmt.Println(getType(tst4))

}
</code></pre>

<p>Go playground: <a href="http://play.golang.org/p/tD8mygvETH" rel="noreferrer">http://play.golang.org/p/tD8mygvETH</a></p>

<p>But the output is:</p>

<pre><code>Hello, playground
string
int
float64


Program exited.
</code></pre>

<p>Expected output would be:</p>

<pre><code>Hello, playground
string
int
float64
Ab

Program exited.
</code></pre>

<p>I tried to figure out by reading the documentation but didn't find the issue about that. So, sorry for the very general question, but:</p>

<p>What's the reason, <code>reflect.TypeOf().Name()</code> does not work with (this) struct(s)?</p>