chore(nix/buildGo): bump to go 1.19

Reading from lukegb's tea leaves.

Change-Id: I5705fcb3212943e62de6e74cf8460171383121d5
Reviewed-on: https://cl.tvl.fyi/c/depot/+/9796
Autosubmit: flokli <flokli@flokli.de>
Reviewed-by: Connor Brewster <cbrewster@hey.com>
Tested-by: BuildkiteCI
This commit is contained in:
Florian Klink 2023-10-24 23:36:18 +03:00 committed by flokli
parent 6a04ba6bc5
commit 5c91ddbeef

View file

@ -24,8 +24,8 @@ let
inherit (pkgs) lib runCommand fetchFromGitHub protobuf symlinkJoin; inherit (pkgs) lib runCommand fetchFromGitHub protobuf symlinkJoin;
# TODO: Adapt to Go 1.19 changes # TODO: Adapt to Go 1.20 changes
go = pkgs.go_1_18; go = pkgs.go_1_19;
# Helpers for low-level Go compiler invocations # Helpers for low-level Go compiler invocations
spaceOut = lib.concatStringsSep " "; spaceOut = lib.concatStringsSep " ";
@ -59,7 +59,7 @@ let
program = { name, srcs, deps ? [ ], x_defs ? { } }: program = { name, srcs, deps ? [ ], x_defs ? { } }:
let uniqueDeps = allDeps (map (d: d.gopkg) deps); let uniqueDeps = allDeps (map (d: d.gopkg) deps);
in runCommand name { } '' in runCommand name { } ''
${go}/bin/go tool compile -o ${name}.a -trimpath=$PWD -trimpath=${go} ${includeSources uniqueDeps} ${spaceOut srcs} ${go}/bin/go tool compile -o ${name}.a -trimpath=$PWD -trimpath=${go} -p main ${includeSources uniqueDeps} ${spaceOut srcs}
mkdir -p $out/bin mkdir -p $out/bin
export GOROOT_FINAL=go export GOROOT_FINAL=go
${go}/bin/go tool link -o $out/bin/${name} -buildid nix ${xFlags x_defs} ${includeLibs uniqueDeps} ${name}.a ${go}/bin/go tool link -o $out/bin/${name} -buildid nix ${xFlags x_defs} ${includeLibs uniqueDeps} ${name}.a
@ -79,8 +79,8 @@ let
# This is required for several popular packages (e.g. x/sys). # This is required for several popular packages (e.g. x/sys).
ifAsm = do: lib.optionalString (sfiles != [ ]) do; ifAsm = do: lib.optionalString (sfiles != [ ]) do;
asmBuild = ifAsm '' asmBuild = ifAsm ''
${go}/bin/go tool asm -trimpath $PWD -I $PWD -I ${go}/share/go/pkg/include -D GOOS_linux -D GOARCH_amd64 -gensymabis -o ./symabis ${spaceOut sfiles} ${go}/bin/go tool asm -p ${path} -trimpath $PWD -I $PWD -I ${go}/share/go/pkg/include -D GOOS_linux -D GOARCH_amd64 -gensymabis -o ./symabis ${spaceOut sfiles}
${go}/bin/go tool asm -trimpath $PWD -I $PWD -I ${go}/share/go/pkg/include -D GOOS_linux -D GOARCH_amd64 -o ./asm.o ${spaceOut sfiles} ${go}/bin/go tool asm -p ${path} -trimpath $PWD -I $PWD -I ${go}/share/go/pkg/include -D GOOS_linux -D GOARCH_amd64 -o ./asm.o ${spaceOut sfiles}
''; '';
asmLink = ifAsm "-symabis ./symabis -asmhdr $out/go_asm.h"; asmLink = ifAsm "-symabis ./symabis -asmhdr $out/go_asm.h";
asmPack = ifAsm '' asmPack = ifAsm ''