在633ab74之前,reflect.StructOf的替代方法是什么?

huangapple go评论74阅读模式
英文:

What alternative to reflect.StructOf exists, prior to its addition to in 633ab74?

问题

我有一些使用reflect.StructOf的代码,这个函数应该会在go1.7中发布。但我不知道的是,这个函数直到大约两周前才可用,并且只在当前的master分支中。在这个方法被添加之前,如何在运行时创建自定义的结构体呢?

英文:

I have some code that makes use of reflect.StructOf, which will presumably land in go1.7. Little did I know, that this wasn't available until only about 2 weeks ago, and only in current master. How does one create custom structs at runtime prior to this method being added?

答案1

得分: 4

在 reflect.StructOf 添加之前,无法在运行时创建新的结构体类型。

英文:

There was no way to create a new struct type at runtime prior to the addition of reflect.StructOf.

huangapple
  • 本文由 发表于 2016年4月18日 18:57:37
  • 转载请务必保留本文链接:https://go.coder-hub.com/36692030.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定