Likely this is compiling firstname.lastname@example.org/util/html5entities.go which is a big map with complicated entries.
I can compile using about 3GB on my machine. Not sure why it goes to 5+GB for you, but yes, that seems overkill.
Without -N -l it takes under 200MB. In particular, -N is the culprit.
Probably a dup of #41058 .
Also see #37741 for another instance of this code causing trouble :(
Looks like lots of time+space spent in regalloc. The liveness maps get really big. (~30K blocks, ~5K live values per block.) Maybe there's something we could do here. Turn on some processing that's normally off with -N when functions are big, or something like that. Maybe there's also a tweak to map building that could trim liveness (e.g. a VarKill in the right spot).
Improving regalloc to make it not use quadratic space would be even better, but that's not easy.
One for each allocation in the map literal (the code in question allocates a int as part of the map entry). They are all only used for a single map assignment. At the first map entry assignment, they are all live.