If you’re reading this post you’re probably searching on Google how to solve this problem: you’re passing a pointer to a
map in a function, and when referencing an item with
*variable, you get that error.
How do I solve it?
The solution is simple: instead of using
Why am I getting this weird error? 🤔
*variable is interpreted by the Go compiler as
*(variable). So what you’re telling the compiler to do is, get the first element in the slice, or the map item with key 0, and dereference that pointer.
This explains the error:
variable in that context is a pointer, not a value, so you cannot get the  item of a pointer to an address, you need to dereference it first to get the value, which is what I think you are trying to do in the first place.
Here's my latest YouTube video. I talk about work/life balance as a developer: