I can't find anything online about doing this (bazel or not), but it would be nice if go_binary could expose malloc attribute (like cc_binary, maybe named cgo_malloc in this case) and/or support --custom_malloc. I could not find an existing way to make this work.
Use case: some go programs might be primarily cgo calls around larger C++ libraries (like for ml) and it would be nice to be able to use mimalloc or tcmalloc there. Presumably this can work with LD_PRELOAD but I was hoping for a static solution.