Skip to content

Commit

Permalink
Merge pull request #279620 from SuperSandro2000/go-licenses-fix
Browse files Browse the repository at this point in the history
go-licenses: fix returning empty output when GOROOT differs from built environment
  • Loading branch information
NickCao authored Jan 14, 2024
2 parents 5dd94ac + ea633d6 commit 1e48199
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions pkgs/development/tools/misc/go-licenses/default.nix
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
{ lib
, buildGoModule
, fetchFromGitHub
, go
, installShellFiles
, makeWrapper
}:

buildGoModule rec {
Expand All @@ -26,13 +28,23 @@ buildGoModule rec {

nativeBuildInputs = [
installShellFiles
makeWrapper
];

subPackages = [ "." ];

allowGoReference = true;

postInstall = ''
installShellCompletion --cmd go-licenses \
--bash <("$out/bin/go-licenses" completion bash) \
--fish <("$out/bin/go-licenses" completion fish) \
--zsh <("$out/bin/go-licenses" completion zsh)
# workaround empty output when GOROOT differs from built environment
# see https://github.com/google/go-licenses/issues/149
wrapProgram "$out/bin/go-licenses" \
--set GOROOT '${go}/share/go'
'';

# Tests require internet connection
Expand Down

0 comments on commit 1e48199

Please sign in to comment.