From 8698c2a7d5096144f14680704c4fba707e196518 Mon Sep 17 00:00:00 2001 From: John Children <32305209+johnchildren@users.noreply.github.com> Date: Fri, 24 May 2019 17:10:35 +0100 Subject: [PATCH] buildGoModule: pre-initialize module cache (#61967) For some Go projects a go.mod file is included but there are no listed dependencies. When this is encountered the Go toolchain will not create a cache folder for downloaded dependencies which causes buildGoModule to fail. An example of a project like this that is widely used is: https://github.com/golang/protobuf This commit adds a mkdir command to ensure that the directory always exists so it can be copied and prevent the failure. --- pkgs/development/go-modules/generic/default.nix | 1 + 1 file changed, 1 insertion(+) diff --git a/pkgs/development/go-modules/generic/default.nix b/pkgs/development/go-modules/generic/default.nix index fed0234b46c..ca1bab1e087 100644 --- a/pkgs/development/go-modules/generic/default.nix +++ b/pkgs/development/go-modules/generic/default.nix @@ -54,6 +54,7 @@ let export GOCACHE=$TMPDIR/go-cache export GOPATH="$TMPDIR/go" + mkdir -p "''${GOPATH}/pkg/mod/cache/download" runHook postConfigure '';