1{
2 lib,
3 buildGoModule,
4 fetchFromGitHub,
5 nix-update-script,
6}:
7
8buildGoModule (finalAttrs: {
9 pname = "go-xmlstruct";
10 version = "1.11.0";
11
12 src = fetchFromGitHub {
13 owner = "twpayne";
14 repo = "go-xmlstruct";
15 tag = "v${finalAttrs.version}";
16 hash = "sha256-YTVPxC3HoSuWgNkFkhNr4ytYbL+AiIkzjLBfkGNmv+M=";
17 };
18
19 vendorHash = "sha256-myt5JjEDnLfkYkB+yb/oaH4dgIOB9qFcqcEb6KO5vBk=";
20
21 doInstallCheck = true;
22 installCheckPhase = ''
23 runHook preInstallCheck
24
25 # The --help flag doesn't actually exist in goxmlstruct, causing it to return exit code 2,
26 # but this error condition is the only way to get the usage information.
27 output=$($out/bin/goxmlstruct --help 2>&1 || true)
28
29 if ! echo "$output" | grep -q "Usage of $out/bin/goxmlstruct:"; then
30 echo "Expected usage information not found in output"
31 echo "Got: $output"
32 exit 1
33 fi
34
35 runHook postInstallCheck
36 '';
37
38 passthru = {
39 updateScript = nix-update-script { };
40 };
41
42 meta = {
43 description = "Generate Go structs from multiple XML documents";
44 mainProgram = "goxmlstruct";
45 homepage = "https://github.com/twpayne/go-xmlstruct";
46 changelog = "https://github.com/twpayne/go-xmlstruct/releases/tag/v${finalAttrs.version}";
47 license = lib.licenses.mit;
48 maintainers = with lib.maintainers; [ dvcorreia ];
49 };
50})