gopls: modernize derivation

This commit is contained in:
KSJ2000 2025-03-28 13:06:26 +02:00
parent 6d554c08cd
commit fe7b85f334

View file

@ -2,16 +2,18 @@
lib,
buildGoModule,
fetchFromGitHub,
nix-update-script,
versionCheckHook,
}:
buildGoModule rec {
buildGoModule (finalAttrs: {
pname = "gopls";
version = "0.18.1";
src = fetchFromGitHub {
owner = "golang";
repo = "tools";
rev = "gopls/v${version}";
tag = "gopls/v${finalAttrs.version}";
hash = "sha256-5w6R3kaYwrZyhIYjwLqfflboXT/z3HVpZiowxeUyaWg=";
};
@ -19,7 +21,7 @@ buildGoModule rec {
vendorHash = "sha256-/tca93Df90/8K1dqhOfUsWSuFoNfg9wdWy3csOtFs6Y=";
# https://github.com/golang/tools/blob/9ed98faa/gopls/main.go#L27-L30
ldflags = [ "-X main.version=v${version}" ];
ldflags = [ "-X main.version=v${finalAttrs.version}" ];
doCheck = false;
@ -30,12 +32,18 @@ buildGoModule rec {
"internal/analysis/modernize/cmd/modernize"
];
meta = with lib; {
doInstallCheck = true;
nativeInstallCheckInputs = [ versionCheckHook ];
versionCheckProgramArg = "version";
passthru.updateScript = nix-update-script { extraArgs = [ "--version-regex=gopls/(.*)" ]; };
meta = {
changelog = "https://github.com/golang/tools/releases/tag/gopls/v${finalAttrs.version}";
description = "Official language server for the Go language";
homepage = "https://github.com/golang/tools/tree/master/gopls";
changelog = "https://github.com/golang/tools/releases/tag/${src.rev}";
license = licenses.bsd3;
maintainers = with maintainers; [
license = lib.licenses.bsd3;
maintainers = with lib.maintainers; [
mic92
rski
SuperSandro2000
@ -43,4 +51,4 @@ buildGoModule rec {
];
mainProgram = "gopls";
};
}
})