As a follow on to my previous post:
I’m attempting to use gomod2nix’s mkGoEnv to acquire the dependencies, but it fails with the following:
error: go.mod specified Go version 1.20, but no compatible Go attribute could be found.
The relevant code from gomod2nix seems to be:
# Return a Go attribute and error out if the Go version is older than was specified in go.mod.
selectGo = attrs: goMod: attrs.go or (if goMod == null then buildPackages.go else
(
let
goVersion = goMod.go;
goAttrs = lib.reverseList (builtins.filter
(
attr: lib.hasPrefix "go_" attr && lib.versionAtLeast buildPackages.${attr}.version goVersion
)
(lib.attrNames buildPackages));
goAttr = elemAt goAttrs 0;
in
(
if goAttrs != [ ]
then buildPackages.${goAttr}
else throw "go.mod specified Go version ${goVersion}, but no compatible Go attribute could be found."
)
));
I attempted the following in nix repl:
nix-repl> :l <nixpkgs>
Added 19222 variables.
nix-repl> :t buildPackages
a set
nix-repl> lib.reverseList (builtins.filter (attr: lib.hasPrefix "go_" attr && lib.versionAtLeast buildPackages.${attr}.version "1.20")(lib.attrNames buildPackages))
[ "go_1_20" ]
It’s not clear to me why gomod2nix isn’t able to find Go.