gqlgenc: add versionCheckHook

This commit is contained in:
Sizhe Zhao
2025-05-19 15:50:15 +08:00
parent da79d11260
commit df06134e63
2 changed files with 29 additions and 0 deletions
+11
View File
@@ -0,0 +1,11 @@
--- a/main.go
+++ b/main.go
@@ -9,7 +9,7 @@
"github.com/urfave/cli/v2"
)
-const version = "0.31.0"
+var version string
var versionCmd = &cli.Command{
Name: "version",
+18
View File
@@ -2,6 +2,7 @@
buildGoModule,
fetchFromGitHub,
lib,
versionCheckHook,
}:
buildGoModule rec {
@@ -15,10 +16,27 @@ buildGoModule rec {
sha256 = "sha256-AGbE+R3502Igl4/HaN8yvFVJBsKQ6iVff8IEvddJLEo=";
};
patches = [
./fix-version.patch
];
excludedPackages = [ "example" ];
vendorHash = "sha256-kBv9Kit5KdPB48V/g1OaeB0ABFd1A1I/9F5LaQDWxUE=";
ldflags = [
"-X"
"main.version=${version}"
];
doInstallCheck = true;
nativeInstallCheckInputs = [ versionCheckHook ];
versionCheckProgramArg = "version";
# FAIL: TestLoadConfig_LoadSchema/correct_schema
# panic: httptest: failed to listen on a port: listen tcp6 [::1]:0: bind: operation not permitted
__darwinAllowLocalNetworking = true;
meta = with lib; {
description = "Go tool for building GraphQL client with gqlgen";
mainProgram = "gqlgenc";