2021-09-12から1日間の記事一覧

mapの値を更新したい場合

Go

Goでmapの値を更新したい場合 次のようにmapへ直接更新することはできない type Sample struct { state bool } var samples = map[string]Sample{ "hoge": {true}, "fuga": {false}, } fmt.Println(samples["hoge"].state) // getはできる samples["hoge"].s…