code: func (g *Generator) getType(t reflect.Type) string {
  	if t.Name() == "" {
  		switch t.Kind() {
  		case reflect.Ptr:
  			return "*" + g.getType(t.Elem())
  		case reflect.Slice:
  			return "[]" + g.getType(t.Elem())
  		case reflect.Array:
  			return "[" + strconv.Itoa(t.Len()) + "]" + g.getType(t.Elem())
  		case reflect.Map:
  			return "map[" + g.getType(t.Key()) + "]" + g.getType(t.Elem())
  		}
  	}
  
  	if t.Name() == "" || t.PkgPath() == "" {
  		if t.Kind() == reflect.Struct {
  			// the fields of an anonymous struct can have named types,
  			// and t.String() will not be sufficient because it does not
  			// remove the package name when it matches g.pkgPath.
  			// so we convert by hand
  			nf := t.NumField()
  			lines := make([]string, 0, nf)
  			for i := 0; i < nf; i++ {
  				f := t.Field(i)
  				var line string
  				if !f.Anonymous {
  					line = f.Name + " "
  				} // else the field is anonymous (an embedded type)
  				line += g.getType(f.Type)
  				t := f.Tag
  				if t != "" {
  					line += " " + escapeTag(t)
  				}
  				lines = append(lines, line)
  			}
  			return strings.Join([]string{"struct { ", strings.Join(lines, "; "), " }"}, "")
  		}
  		return t.String()
  	} else if t.PkgPath() == g.pkgPath {
  		return t.Name()
  	}
  	return g.pkgAlias(t.PkgPath()) + "." + t.Name()
  }
docs: // getType return the textual type name of given type that can be used in generated code.