stack/source.go
func fieldToType(f *ast.Field) (string, bool) {
	switch arg := f.Type.(type) {
	case *ast.ArrayType:
		return "[]" + name(arg.Elt), false
	case *ast.Ellipsis:
		return name(arg.Elt), true
	case *ast.FuncType:
		// Do not print the function signature to not overload the trace.
		return "func", false
	case *ast.Ident:
		return arg.Name, false
	case *ast.InterfaceType:
		return "interface{}", false
	case *ast.SelectorExpr:
		return arg.Sel.Name, false
	case *ast.StarExpr:
		return "*" + name(arg.X), false
	case *ast.MapType:
		return fmt.Sprintf("map[%s]%s", name(arg.Key), name(arg.Value)), false
	case *ast.ChanType:
		return fmt.Sprintf("chan %s", name(arg.Value)), false
	default:
		// TODO(maruel): Implement anything missing.
		return "<unknown>", false
	}
}
func fieldToType(f *ast.Field) (string, bool) {
	switch arg := f.Type.(type) {
	case *ast.ArrayType:
		return "[]" + name(arg.Elt), false
	case *ast.Ellipsis:
		return name(arg.Elt), true
	case *ast.FuncType:
		// Do not print the function signature to not overload the trace.
		return "func", false
	case *ast.Ident:
		return arg.Name, false
	case *ast.InterfaceType:
		return "interface{}", false
	case *ast.SelectorExpr:
		return arg.Sel.Name, false
	case *ast.StarExpr:
		return "*" + name(arg.X), false
	case *ast.MapType:
		return fmt.Sprintf("map[%s]%s", name(arg.Key), name(arg.Value)), false
	case *ast.ChanType:
		return fmt.Sprintf("chan %s", name(arg.Value)), false
	default:
		// TODO(maruel): Implement anything missing.
		return "<unknown>", false
	}
}
func fieldToType ( f * ast . Field ) ( string , bool ) { switch arg := f . Type . ( type ) { case * ast . ArrayType : return " " + name ( arg . Elt ) , false case * ast . Ellipsis : return name ( arg . Elt ) , true case * ast . FuncType : // Do not print the function signature to not overload the trace. return " " , false case * ast . Ident : return arg . Name , false case * ast . InterfaceType : return " " , false case * ast . SelectorExpr : return arg . Sel . Name , false case * ast . StarExpr : return " " + name ( arg . X ) , false case * ast . MapType : return fmt . Sprintf ( " " , name ( arg . Key ) , name ( arg . Value ) ) , false case * ast . ChanType : return fmt . Sprintf ( " " , name ( arg . Value ) ) , false default : // TODO(maruel): Implement anything missing. return " " , false } }
// fieldToType returns the type name and whether if it's an ellipsis.
fieldToType returns the type name and whether if it s an ellipsis .