buildGoModule replace behavior

Where can I learn more or help with making buildGoModule better?

As I see it right now the replace directive isn’t correctly implemented if you change the import/upstream location. It fetches the module but stores it under the wrong path.

The function itself is implemented here: https://github.com/NixOS/nixpkgs/blob/e3fbbb1d108988069383a78f424463e6be087707/pkgs/development/go-packages/generic/default.nix