2021-02-05 17:12:51 +00:00
|
|
|
{ lib, buildGoModule, fetchgit }:
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
buildGoModule rec {
|
2022-03-30 09:31:56 +00:00
|
|
|
pname = "gotools";
|
|
|
|
version = "0.1.10";
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
src = fetchgit {
|
2022-03-30 09:31:56 +00:00
|
|
|
rev = "v${version}";
|
2020-04-24 23:36:52 +00:00
|
|
|
url = "https://go.googlesource.com/tools";
|
2022-03-30 09:31:56 +00:00
|
|
|
sha256 = "sha256-r71+//VhayW18uvMl/ls/8KYNbZ7uDZw3SWoqPL3Xqk=";
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
|
2020-09-25 04:45:31 +00:00
|
|
|
# The gopls folder contains a Go submodule which causes a build failure.
|
|
|
|
# Given that, we can't have the gopls binary be part of the gotools
|
|
|
|
# derivation.
|
|
|
|
#
|
|
|
|
# The attribute "gopls" provides the gopls binary.
|
|
|
|
#
|
|
|
|
# Related
|
|
|
|
#
|
|
|
|
# * https://github.com/NixOS/nixpkgs/pull/85868
|
|
|
|
# * https://github.com/NixOS/nixpkgs/issues/88716
|
2020-04-24 23:36:52 +00:00
|
|
|
postPatch = ''
|
|
|
|
rm -rf gopls
|
|
|
|
'';
|
|
|
|
|
2022-03-30 09:31:56 +00:00
|
|
|
vendorSha256 = "sha256-UJIXG8WKzazNTXoqEFlT/umC40F6z2Q5I8RfxnMbsPM=";
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2020-08-20 17:08:02 +00:00
|
|
|
doCheck = false;
|
|
|
|
|
2020-04-24 23:36:52 +00:00
|
|
|
postConfigure = ''
|
|
|
|
# Make the builtin tools available here
|
|
|
|
mkdir -p $out/bin
|
|
|
|
eval $(go env | grep GOTOOLDIR)
|
|
|
|
find $GOTOOLDIR -type f | while read x; do
|
|
|
|
ln -sv "$x" "$out/bin"
|
|
|
|
done
|
|
|
|
export GOTOOLDIR=$out/bin
|
|
|
|
'';
|
|
|
|
|
2022-04-15 01:41:22 +00:00
|
|
|
excludedPackages = [ "vet" "cover" ];
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
# Set GOTOOLDIR for derivations adding this to buildInputs
|
|
|
|
postInstall = ''
|
|
|
|
mkdir -p $out/nix-support
|
|
|
|
substitute ${../../go-modules/tools/setup-hook.sh} $out/nix-support/setup-hook \
|
|
|
|
--subst-var-by bin $out
|
|
|
|
'';
|
|
|
|
|
|
|
|
# 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;
|
2022-03-30 09:31:56 +00:00
|
|
|
|
|
|
|
meta = with lib; {
|
|
|
|
description = "Additional tools for Go development";
|
|
|
|
homepage = "http://go.googlesource.com/tools";
|
|
|
|
license = licenses.bsd3;
|
|
|
|
maintainers = with maintainers; [ danderson ];
|
|
|
|
};
|
2020-08-20 17:08:02 +00:00
|
|
|
}
|