languages/go: cleanup; add defaultText for non-primitive defaults
Some checks are pending
Set up binary cache / cachix (default) (push) Waiting to run
Set up binary cache / cachix (maximal) (push) Waiting to run
Set up binary cache / cachix (nix) (push) Waiting to run
Treewide Checks / Validate flake (push) Waiting to run
Treewide Checks / Check formatting (push) Waiting to run
Treewide Checks / Check source tree for typos (push) Waiting to run
Treewide Checks / Validate documentation builds (push) Waiting to run
Treewide Checks / Validate documentation builds-1 (push) Waiting to run
Treewide Checks / Validate documentation builds-2 (push) Waiting to run
Treewide Checks / Validate documentation builds-3 (push) Waiting to run
Treewide Checks / Validate hyperlinks in documentation sources (push) Waiting to run
Treewide Checks / Validate Editorconfig conformance (push) Waiting to run
Build and deploy documentation / Check latest commit (push) Waiting to run
Build and deploy documentation / publish (push) Blocked by required conditions

Signed-off-by: NotAShelf <raf@notashelf.dev>
Change-Id: Ibd01b64851f1b5800cf917f97e9be4fa6a6a6964
This commit is contained in:
raf 2026-03-02 23:33:12 +03:00
commit 750dbfaf6e
Signed by: NotAShelf
GPG key ID: 29D95B64378DB4BF

View file

@ -65,9 +65,11 @@
gofmt = {
command = "${pkgs.go}/bin/gofmt";
};
gofumpt = {
command = getExe pkgs.gofumpt;
};
golines = {
command = "${pkgs.golines}/bin/golines";
};
@ -169,7 +171,12 @@ in {
enable = mkEnableOption "Go language support";
treesitter = {
enable = mkEnableOption "Go treesitter" // {default = config.vim.languages.enableTreesitter;};
enable =
mkEnableOption "Go treesitter"
// {
default = config.vim.languages.enableTreesitter;
defaultText = literalExpression "config.vim.languages.enableTreesitter";
};
goPackage = mkGrammarOption pkgs "go";
gomodPackage = mkGrammarOption pkgs "gomod";
@ -179,7 +186,12 @@ in {
};
lsp = {
enable = mkEnableOption "Go LSP support" // {default = config.vim.lsp.enable;};
enable =
mkEnableOption "Go LSP support"
// {
default = config.vim.lsp.enable;
defaultText = literalExpression "config.vim.lsp.enable";
};
servers = mkOption {
type = deprecatedSingleOrListOf "vim.language.go.lsp.servers" (enum (attrNames servers));
@ -199,39 +211,48 @@ in {
};
type = mkOption {
description = "Go formatter to use";
type = deprecatedSingleOrListOf "vim.language.go.format.type" (enum (attrNames formats));
default = defaultFormat;
description = "Go formatter to use";
};
};
dap = {
enable = mkOption {
description = "Enable Go Debug Adapter via nvim-dap-go plugin";
type = bool;
enable =
mkEnableOption "Go Debug Adapter (DAP) via `nvim-dap-go"
// {
default = config.vim.languages.enableDAP;
defaultText = literalExpression "config.vim.languages.enableDAP";
};
debugger = mkOption {
description = "Go debugger to use";
type = enum (attrNames debuggers);
default = defaultDebugger;
description = "Go debugger to use";
};
package = mkOption {
description = "Go debugger package.";
type = package;
default = debuggers.${cfg.dap.debugger}.package;
description = "Go debugger package.";
};
};
extraDiagnostics = {
enable = mkEnableOption "extra Go diagnostics" // {default = config.vim.languages.enableExtraDiagnostics;};
enable =
mkEnableOption "extra Go diagnostics"
// {
default = config.vim.languages.enableExtraDiagnostics;
defaultText = literalExpression "config.vim.languages.enableExtraDiagnostic";
};
types = diagnostics {
langDesc = "Go";
inherit diagnosticsProviders;
inherit defaultDiagnosticsProvider;
};
};
extensions = {
gopher-nvim = {
enable = mkEnableOption "Minimalistic plugin for Go development";
@ -242,29 +263,39 @@ in {
default = "go";
description = "Go binary to use";
};
gomodifytags = mkOption {
type = str;
default = getExe pkgs.gomodifytags;
defaultText = literalExpression "getExe pkgs.gomodifytags";
description = "gomodifytags binary to use";
};
gotests = mkOption {
type = str;
default = getExe pkgs.gotests;
defaultText = literalExpression "getExe pkgs.gotests";
description = "gotests binary to use";
};
impl = mkOption {
type = str;
default = getExe pkgs.impl;
defaultText = literalExpression "getExe pkgs.impl";
description = "impl binary to use";
};
iferr = mkOption {
type = str;
default = getExe pkgs.iferr;
defaultText = literalExpression "getExe pkgs.iferr";
description = "iferr binary to use";
};
json2go = mkOption {
type = str;
default = literalExpression "getExe inputs.self.packages.$${pkgs.stdenv.hostPlatform.system}.json2go";
default = getExe inputs.self.packages.${pkgs.stdenv.hostPlatform.system}.json2go;
defaultText = literalExpression "getExe inputs.self.packages.$${pkgs.stdenv.hostPlatform.system}.json2go";
description = "json2go binary to use";
};
};
@ -275,14 +306,16 @@ in {
config = mkIf cfg.enable (mkMerge [
(mkIf cfg.treesitter.enable {
vim.treesitter.enable = true;
vim.treesitter.grammars = [
vim.treesitter = {
enable = true;
grammars = [
cfg.treesitter.goPackage
cfg.treesitter.gomodPackage
cfg.treesitter.gosumPackage
cfg.treesitter.goworkPackage
cfg.treesitter.gotmplPackage
];
};
})
(mkIf cfg.lsp.enable {