From 820dc3001b772b90e11b3242c7ab98d14a90b4c1 Mon Sep 17 00:00:00 2001 From: Kristoffer Dalby Date: Tue, 25 Aug 2026 10:56:02 +0000 Subject: [PATCH] flake: build Go-parsing tools with the project's Go goimports, gotools' goimports wrapper and golangci-lint-langserver were on the nixpkgs default Go, whose parser rejects generic methods. --- flake.nix | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/flake.nix b/flake.nix index 9bbccf0ee..c8e284f4d 100644 --- a/flake.nix +++ b/flake.nix @@ -82,6 +82,18 @@ golines = prev.golines.override { buildGoModule = buildGo; }; + + # goimports and friends: they parse Go with the parser of the Go + # they were built with, so an older one rejects new syntax. + gotools = prev.gotools.override { + buildGoModule = buildGo; + # goimports is wrapped with this go on PATH for module lookups. + go = pkgs.go_latest; + }; + + golangci-lint-langserver = prev.golangci-lint-langserver.override { + buildGoModule = buildGo; + }; }; } // flake-utils.lib.eachDefaultSystem @@ -106,6 +118,8 @@ gotests gofumpt gopls + gotools + ksh ko yq-go