Looks like this is caused by not enough virtual memory
$ ulimit -v 242000
$ go build prog.go
runtime: panic before malloc heap initialized
fatal error: runtime: cannot allocate heap metadata
64bit go needs lots of virtual memory space but not necessarily that much real memory.
You could fix this by allocating more memory to the container.
You could also play with the setting of /proc/sys/vm/overcommit_memory
.
You could also try allocating swap to the container (if possible).