Question: I've tried to identify a struct with string value(name).
`reflect.TypeOf` returns `Type`.

But type assertion needs a `type`.

How can I casting `Type` to `type`?

Or any suggestion to handle it?

<http://play.golang.org/p/3PJG3YxIyf>

```
package main

import (
"fmt"
"reflect"
)
type Article struct {
    Id             int64       `json:"id"`
    Title          string      `json:"title",sql:"size:255"`
    Content        string      `json:"content"`
}

func IdentifyItemType(name string) interface{} {
    var item interface{}
    switch name {
    default:
        item = Article{}
    }
    return item
}

func main() {

    i := IdentifyItemType("name")
    item := i.(Article)
    fmt.Printf("Hello, item : %v\n", item)
    item2 := i.(reflect.TypeOf(i))  // reflect.TypeOf(i) is not a type
    fmt.Printf("Hello, item2 : %v\n", item2)

}

```

Answer: 
Lots of things, but basically "it doesn't work that way". The thing inside the parentheses in a type assertion needs to be a [type](https://golang.org/ref/spec#Type), that is a type name or a type literal. `reflect.TypeOf(i)` isn't one of those, it's a method call expression. Therefore this is a syntax error. [reflect.TypeOf](https://golang.org/pkg/reflect/#TypeOf) doesn't "return a type" (which isn't really a thing you can do in Go), it returns a [reflect.Type](https://golang.org/pkg/reflect/#Type), which is an ordinary go struct that contains information *about* a type (i.e. sort of a meta-type).

But the more fundamental reason why it doesn't work is because it *can't*... Go needs to know what the type of a variable is when it's declared. Either its type is given explicitly in a `var` declaration, or it's inferred from the type of the initialization value in a `var x = value` declaration or `x := value` short assignment. It is *not possible* for the type to be unknown at compile time. Go doesn't let you write an expression that produces an undetermined type.

The very purpose of a type assertion is to take a value of an interface type (which is a kind of "box" that can hold values of multiple types, or for `interface{}`, any type at all) and retrieve a value of a *specific* concrete type. The value produced by the assertion will have the type named by the assertion, and no other. (In the case of a `,ok` assignment, if the assertion fails, the variable will hold a [zero value](https://golang.org/ref/spec#The_zero_value) but still be of the correct type). If you could write an assertion to a type that was known only at runtime, the whole thing would fall apart, so you can't write it — it's an error.

In short, you can't use reflection to do that. You can use reflect to learn what the type of `i` is, you can learn that type's name, you can learn that its underlying [Kind](https://golang.org/pkg/reflect/#Kind) is Struct, you can enumerate the struct's fields and get the values out of them, etc... all of these are legitimate uses of reflection. But it can't give you back a variable of type `MyStruct` — the way to do that is `i.(MyStruct)`.
I think you can use ValueOf to solve this

```
item2 :=  reflect.ValueOf(i)
fmt.Printf("Hello, item2 : %v\n", item2)

```