2020-03-21 13:44:57 +00:00
|
|
|
{ stdenv, go, buildGoModule, fetchgit, Security }:
|
2016-06-06 00:28:52 +00:00
|
|
|
|
2019-03-08 23:14:33 +00:00
|
|
|
buildGoModule rec {
|
2019-08-15 12:41:18 +00:00
|
|
|
pname = "gotools-unstable";
|
2019-11-14 23:33:59 +00:00
|
|
|
version = "2019-11-14";
|
|
|
|
rev = "4191b8cbba092238a318a71cdff48b20b4e1e5d8";
|
2016-06-06 00:28:52 +00:00
|
|
|
|
|
|
|
src = fetchgit {
|
|
|
|
inherit rev;
|
|
|
|
url = "https://go.googlesource.com/tools";
|
2019-11-14 23:33:59 +00:00
|
|
|
sha256 = "16m62m303j4wqfjr1401xpqpb9m11bs6qc2dhf6x2za2d9pycish";
|
2016-06-06 00:28:52 +00:00
|
|
|
};
|
|
|
|
|
2020-03-21 13:44:57 +00:00
|
|
|
buildInputs = stdenv.lib.optional stdenv.isDarwin Security;
|
|
|
|
|
2019-07-05 11:11:13 +00:00
|
|
|
# Build of golang.org/x/tools/gopls fails with:
|
|
|
|
# can't load package: package golang.org/x/tools/gopls: unknown import path "golang.org/x/tools/gopls": cannot find module providing package golang.org/x/tools/gopls
|
|
|
|
# That is most probably caused by golang.org/x/tools/gopls containing a separate Go module.
|
|
|
|
# In order to fix this, we simply remove the module.
|
|
|
|
# Note that build of golang.org/x/tools/cmd/gopls provides identical binary as golang.org/x/tools/gopls.
|
|
|
|
# See https://github.com/NixOS/nixpkgs/pull/64335.
|
|
|
|
postPatch = ''
|
|
|
|
rm -rf gopls
|
|
|
|
'';
|
|
|
|
|
2019-09-05 19:46:30 +00:00
|
|
|
modSha256 = "16cfzmfr9jv8wz0whl433xdm614dk63fzjxv6l1xvkagjmki49iy";
|
2016-06-06 00:28:52 +00:00
|
|
|
|
2019-03-22 03:40:07 +00:00
|
|
|
postConfigure = ''
|
2016-06-06 00:28:52 +00:00
|
|
|
# Make the builtin tools available here
|
2019-03-08 23:14:33 +00:00
|
|
|
mkdir -p $out/bin
|
2016-06-06 00:28:52 +00:00
|
|
|
eval $(go env | grep GOTOOLDIR)
|
|
|
|
find $GOTOOLDIR -type f | while read x; do
|
2019-03-08 23:14:33 +00:00
|
|
|
ln -sv "$x" "$out/bin"
|
2016-06-06 00:28:52 +00:00
|
|
|
done
|
2019-03-08 23:14:33 +00:00
|
|
|
export GOTOOLDIR=$out/bin
|
2016-06-06 00:28:52 +00:00
|
|
|
'';
|
|
|
|
|
|
|
|
excludedPackages = "\\("
|
|
|
|
+ stdenv.lib.concatStringsSep "\\|" ([ "testdata" ] ++ stdenv.lib.optionals (stdenv.lib.versionAtLeast go.meta.branch "1.5") [ "vet" "cover" ])
|
|
|
|
+ "\\)";
|
|
|
|
|
|
|
|
# Set GOTOOLDIR for derivations adding this to buildInputs
|
|
|
|
postInstall = ''
|
2019-03-08 23:14:33 +00:00
|
|
|
mkdir -p $out/nix-support
|
2020-01-21 05:09:11 +00:00
|
|
|
substitute ${../../go-modules/tools/setup-hook.sh} $out/nix-support/setup-hook \
|
|
|
|
--subst-var-by bin $out
|
2016-06-06 00:28:52 +00:00
|
|
|
'';
|
2019-03-08 23:14:33 +00:00
|
|
|
|
|
|
|
# Do not copy this without a good reason for enabling
|
|
|
|
# In this case tools is heavily coupled with go itself and embeds paths.
|
|
|
|
allowGoReference = true;
|
2016-06-06 00:28:52 +00:00
|
|
|
}
|