エントリーの編集
エントリーの編集は全ユーザーに共通の機能です。
必ずガイドラインを一読の上ご利用ください。
Using reflect, how do you set the value of a struct field?
記事へのコメント0件
- 注目コメント
- 新着コメント
このエントリーにコメントしてみましょう。
注目コメント算出アルゴリズムの一部にLINEヤフー株式会社の「建設的コメント順位付けモデルAPI」を使用しています
- バナー広告なし
- ミュート機能あり
- ダークモード搭載
関連記事
Using reflect, how do you set the value of a struct field?
having a rough time working with struct fields using reflect package. in particular, have not fig... having a rough time working with struct fields using reflect package. in particular, have not figured out how to set the field value. type t struct { fi int; fs string } var r t = t{ 123, "jblow" } var i64 int64 = 456 getting Name of field i - this seems to work var field = reflect.TypeOf(r).Field(i).Name getting value of field i as a) interface{}, b) int - this seems to work var iface interface{}