I need to use large maps with large strings as keys. Is there a way in go's default map
to specify the comparison test so that the key is treated as an address? If not, are there good libraries that implement this?
Note that what I want to prevent is long strings constantly being passed by copy whenever a map lookup is made.
For the particular case of strings, Go does what you want by default: strings are currently represented by pointer/length pairs so you're not copying string data around when you copy strings.
In general, you can't specify a custom comparison (or hash) function. Other types and custom structs are treated according to rules listed in the spec: pointers are compared by address, for example, fixed-size arrays are compared by value, and slice types aren't comparable in general so struct types that include them aren't usable as map key types.