summary refs log tree commit diff
path: root/pkgs/development/go-modules/generic
diff options
context:
space:
mode:
authorJohn Children <32305209+johnchildren@users.noreply.github.com>2019-05-24 17:10:35 +0100
committerWael Nasreddine <wael.nasreddine@gmail.com>2019-05-24 09:10:35 -0700
commit8698c2a7d5096144f14680704c4fba707e196518 (patch)
tree93976cdee4fec4b72729c8846675948e6c7ce286 /pkgs/development/go-modules/generic
parent02ea1812c85033386f06ddac2796e75cdb608281 (diff)
downloadnixpkgs-8698c2a7d5096144f14680704c4fba707e196518.tar
nixpkgs-8698c2a7d5096144f14680704c4fba707e196518.tar.gz
nixpkgs-8698c2a7d5096144f14680704c4fba707e196518.tar.bz2
nixpkgs-8698c2a7d5096144f14680704c4fba707e196518.tar.lz
nixpkgs-8698c2a7d5096144f14680704c4fba707e196518.tar.xz
nixpkgs-8698c2a7d5096144f14680704c4fba707e196518.tar.zst
nixpkgs-8698c2a7d5096144f14680704c4fba707e196518.zip
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.
Diffstat (limited to 'pkgs/development/go-modules/generic')
-rw-r--r--pkgs/development/go-modules/generic/default.nix1
1 files changed, 1 insertions, 0 deletions
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
     '';