fix(buildTypedGo): Use builtins.baseNameOf when renaming inputs

Without this, we would end up with "double" store paths like this:

  /nix/store/848js1fvbjniv5n00hifmhgzzszl97vv--nix-store-ad6piq18wdkxnfzsbyn88ixvv7gfb1dp-main.go.drv

We really only care about the `main.go` bit though.

Change-Id: Ib0644781a0e232a45e1cae3dd05b9b828c9087ee
Reviewed-on: https://cl.tvl.fyi/c/depot/+/1321
Tested-by: BuildkiteCI
Reviewed-by: ericvolp12 <ericvolp12@gmail.com>
This commit is contained in:
Vincent Ambo 2020-07-20 03:55:22 +01:00 committed by tazjin
parent 16823d075c
commit 31516eb9cd

View file

@ -8,13 +8,14 @@
let
inherit (builtins)
baseNameOf
stringLength
substring;
inherit (depot.nix.buildGo) gpackage program;
go2goext = file: substring 0 ((stringLength file) - 1) file;
go2go = file: pkgs.runCommandNoCC "${go2goext (toString file)}" {} ''
go2go = file: pkgs.runCommandNoCC "${go2goext (baseNameOf file)}" {} ''
cp ${file} .
${pkgs.go}/bin/go tool go2go translate *.go2
mv *.go $out