Unverified Commit 812353c6 authored by Anthony Roussel's avatar Anthony Roussel Committed by GitHub
Browse files

terraform-docs: fix build (#445041)

parents ae41c334 87559840
Loading
Loading
Loading
Loading
+25 −5
Original line number Diff line number Diff line
{
  stdenv,
  lib,
  buildGoModule,
  # Build fails with Go 1.25, with the following error:
  # 'vendor/golang.org/x/tools/internal/tokeninternal/tokeninternal.go:64:9: invalid array length -delta * delta (constant -256 of type int64)'
  # Wait for upstream to update their vendored dependencies before unpinning.
  buildGo124Module,
  fetchFromGitHub,
  installShellFiles,
  testers,
}:
buildGoModule rec {

buildGo124Module (finalAttrs: {
  pname = "terraform-docs";
  version = "0.20.0";

  src = fetchFromGitHub {
    owner = "terraform-docs";
    repo = "terraform-docs";
    rev = "v${version}";
    tag = "v${finalAttrs.version}";
    hash = "sha256-DiKoYAe7vcNy35ormKHYZcZrGK/MEb6VmcHWPgrbmUg=";
  };

  vendorHash = "sha256-ynyYpX41LJxGhf5kF2AULj+VKROjsvTjVPBnqG+JGSg=";

  ldflags = [
    "-s"
    "-w"
  ];

  env.CGO_ENABLED = 0;

  excludedPackages = [ "scripts" ];

  nativeBuildInputs = [ installShellFiles ];
@@ -29,11 +41,19 @@ buildGoModule rec {
    installShellCompletion terraform-docs.{bash,fish,zsh}
  '';

  passthru.tests.version = testers.testVersion {
    package = finalAttrs.finalPackage;
    version = "v${finalAttrs.version}";
  };

  meta = with lib; {
    description = "Utility to generate documentation from Terraform modules in various output formats";
    mainProgram = "terraform-docs";
    homepage = "https://github.com/terraform-docs/terraform-docs/";
    license = licenses.mit;
    maintainers = with maintainers; [ zimbatm ];
    maintainers = with maintainers; [
      zimbatm
      anthonyroussel
    ];
  };
}
})