From d1d495c8266de59df2a73d0af695bb951e438251 Mon Sep 17 00:00:00 2001 From: Snoweuph Date: Sun, 8 Feb 2026 06:04:09 +0100 Subject: [PATCH] language/go: add gopher.nvim for impl, gomodifytags, iferr and ... support --- docs/manual/release-notes/rl-0.9.md | 3 ++ modules/plugins/languages/go.nix | 47 +++++++++++++++++++++++++++-- npins/sources.json | 13 ++++++++ 3 files changed, 61 insertions(+), 2 deletions(-) diff --git a/docs/manual/release-notes/rl-0.9.md b/docs/manual/release-notes/rl-0.9.md index 4a322868..e339147f 100644 --- a/docs/manual/release-notes/rl-0.9.md +++ b/docs/manual/release-notes/rl-0.9.md @@ -208,6 +208,9 @@ - Added [`golangci-lint`](https://golangci-lint.run/) for more diagnostics. +- Added [`gopher.nvim`](https://github.com/olexsmir/gopher.nvim) for extra + actions in `languages.go`. + - updated default filetypes for [harper-ls](https://github.com/Automattic/harper) to match what they are supposed to be. diff --git a/modules/plugins/languages/go.nix b/modules/plugins/languages/go.nix index da3700a7..f56e287f 100644 --- a/modules/plugins/languages/go.nix +++ b/modules/plugins/languages/go.nix @@ -9,8 +9,8 @@ inherit (lib.modules) mkIf mkMerge; inherit (lib.meta) getExe; inherit (lib.generators) mkLuaInline; - inherit (lib.types) bool enum package; - inherit (lib.nvim.types) mkGrammarOption diagnostics deprecatedSingleOrListOf; + inherit (lib.types) bool enum package str; + inherit (lib.nvim.types) mkGrammarOption diagnostics deprecatedSingleOrListOf mkPluginSetupOption; inherit (lib.nvim.dag) entryAfter; inherit (lib.nvim.attrsets) mapListToAttrs; @@ -231,6 +231,40 @@ in { inherit defaultDiagnosticsProvider; }; }; + extensions = { + gopher-nvim = { + enable = mkEnableOption "Minimalistic plugin for Go development"; + setupOpts = mkPluginSetupOption "gopher-nvim" { + commands = { + go = mkOption { + description = "go binary to use"; + type = str; + default = "go"; + }; + gomodifytags = mkOption { + description = "gomodifytags binary to use"; + type = str; + default = getExe pkgs.gomodifytags; + }; + gotests = mkOption { + description = "gotests binary to use"; + type = str; + default = getExe pkgs.gotests; + }; + impl = mkOption { + description = "impl binary to use"; + type = str; + default = getExe pkgs.impl; + }; + iferr = mkOption { + description = "iferr binary to use"; + type = str; + default = getExe pkgs.iferr; + }; + }; + }; + }; + }; }; config = mkIf cfg.enable (mkMerge [ @@ -292,5 +326,14 @@ in { cfg.extraDiagnostics.types); }; }) + + (mkIf cfg.extensions.gopher-nvim.enable { + vim.lazy.plugins.gopher-nvim = { + package = "gopher-nvim"; + setupModule = "gopher"; + inherit (cfg.extensions.gopher-nvim) setupOpts; + ft = ["go"]; + }; + }) ]); } diff --git a/npins/sources.json b/npins/sources.json index 05b662ff..0dfa7098 100644 --- a/npins/sources.json +++ b/npins/sources.json @@ -669,6 +669,19 @@ "url": "https://github.com/MagicDuck/grug-far.nvim/archive/275dbedc96e61a6b8d1dfb28ba51586ddd233dcf.tar.gz", "hash": "sha256-qn1BTNCX0Sm158Lv5JfHThqlJX9ualCIlc+RCjWa+t8=" }, + "gopher-nvim": { + "type": "Git", + "repository": { + "type": "GitHub", + "owner": "olexsmir", + "repo": "gopher.nvim" + }, + "branch": "main", + "submodules": false, + "revision": "6a3924cee5a9f36d316f8e4a90c3020438d3513f", + "url": "https://github.com/olexsmir/gopher.nvim/archive/6a3924cee5a9f36d316f8e4a90c3020438d3513f.tar.gz", + "hash": "sha256-iXTmgdADtZFQVm+IN+JoPActGuO8r7VTeHKJdkEgmVo=" + }, "gruvbox": { "type": "Git", "repository": {