github.com/altipla-consulting/ravendb-go-client@v0.1.3/handling_maps.md (about)

     1  This document tries to explain how we have to handle maps in Go code because it's a bit special.
     2  
     3  See also https://github.com/altipla-consulting/ravendb-go-client/issues/105 
     4  
     5  Maps have to be passed by a pointer to both `Store` and `Load` methods.
     6  
     7  This is different from structs where `Store` takes a `*Foo` and `Load` takes `**Foo`.
     8  
     9  In Go a map value, under the hood, is a pointer.
    10   
    11  However, we don't have access to that pointer (without using hacks that depend on internals of the runtime/compiler, which might change in the future).
    12  
    13  One result of that is that Go only allows to compare map value to a nil but not to another map.
    14  
    15  The only way to have a stable reference to a map is to use a pointer to it.
    16  
    17  This is similar to taking a pointer to a struct but it does look weird.
    18  
    19  
    20