Skip to content

Commit 17af14c

Browse files
authored
gqlgenc: add versionCheckHook (#398878)
2 parents 3a5e371 + 79a6b79 commit 17af14c

File tree

2 files changed

+35
-6
lines changed

2 files changed

+35
-6
lines changed
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
--- a/main.go
2+
+++ b/main.go
3+
@@ -9,7 +9,7 @@
4+
"github.com/urfave/cli/v2"
5+
)
6+
7+
-const version = "0.31.0"
8+
+var version string
9+
10+
var versionCmd = &cli.Command{
11+
Name: "version",

pkgs/by-name/gq/gqlgenc/package.nix

Lines changed: 24 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,28 +2,46 @@
22
buildGoModule,
33
fetchFromGitHub,
44
lib,
5+
versionCheckHook,
56
}:
67

7-
buildGoModule rec {
8+
buildGoModule (finalAttrs: {
89
pname = "gqlgenc";
910
version = "0.32.1";
1011

1112
src = fetchFromGitHub {
1213
owner = "yamashou";
1314
repo = "gqlgenc";
14-
rev = "v${version}";
15+
rev = "v${finalAttrs.version}";
1516
sha256 = "sha256-AGbE+R3502Igl4/HaN8yvFVJBsKQ6iVff8IEvddJLEo=";
1617
};
1718

19+
patches = [
20+
./fix-version.patch
21+
];
22+
1823
excludedPackages = [ "example" ];
1924

2025
vendorHash = "sha256-kBv9Kit5KdPB48V/g1OaeB0ABFd1A1I/9F5LaQDWxUE=";
2126

22-
meta = with lib; {
27+
ldflags = [
28+
"-X"
29+
"main.version=${finalAttrs.version}"
30+
];
31+
32+
doInstallCheck = true;
33+
nativeInstallCheckInputs = [ versionCheckHook ];
34+
versionCheckProgramArg = "version";
35+
36+
# FAIL: TestLoadConfig_LoadSchema/correct_schema
37+
# panic: httptest: failed to listen on a port: listen tcp6 [::1]:0: bind: operation not permitted
38+
__darwinAllowLocalNetworking = true;
39+
40+
meta = {
2341
description = "Go tool for building GraphQL client with gqlgen";
2442
mainProgram = "gqlgenc";
2543
homepage = "https://github.com/Yamashou/gqlgenc";
26-
license = licenses.mit;
27-
maintainers = with maintainers; [ wattmto ];
44+
license = lib.licenses.mit;
45+
maintainers = with lib.maintainers; [ wattmto ];
2846
};
29-
}
47+
})

0 commit comments

Comments
 (0)