3 ms·
I got caught with maps initially, and had to question why everything else was just "var x string", which also gives it a value, but maps needed a "var x = make(
by xarope 2y ago
I got caught with maps initially, and had to question why everything else was just "var x string", which also gives it a value, but maps needed a "var x = make(make[string]string)", otherwise on first assignment it panics.
There's a good explanation somewhere, ah here it is: https://go.dev/blog/maps https://go.dev/blog/maps
But you get used to it, and move on, especially with the sort of TDD workflow that go test encourages
- usrnm 2y agoI know why it works the way it works, it doesn't make it a good design, which is the point of this discussion
- deleted 2y ago[deleted]