gomod2nix
gomod2nix copied to clipboard
panic with no further information on bad go version
I have a project that depends on something that requires go >= 1.23. When I run gomod2nix I get a panic like:
INFO[0000] Parsing go.mod modPath=go.mod
INFO[0000] Downloading dependencies
panic: error generating pkgs:
goroutine 1 [running]:
github.com/nix-community/gomod2nix/internal/cmd.generateFunc(0xc000180700?, {0xc47f80?, 0x4?, 0x877446?})
/home/eliribble/src/gomod2nix/internal/cmd/root.go:67 +0x40e
github.com/spf13/cobra.(*Command).execute(0xbe1180, {0xc000118040, 0x0, 0x0})
/home/eliribble/go/pkg/mod/github.com/spf13/[email protected]/command.go:989 +0xab1
github.com/spf13/cobra.(*Command).ExecuteC(0xbe1180)
/home/eliribble/go/pkg/mod/github.com/spf13/[email protected]/command.go:1117 +0x3ff
github.com/spf13/cobra.(*Command).Execute(...)
/home/eliribble/go/pkg/mod/github.com/spf13/[email protected]/command.go:1041
github.com/nix-community/gomod2nix/internal/cmd.Execute()
/home/eliribble/src/gomod2nix/internal/cmd/root.go:124 +0x1a
main.main()
/home/eliribble/src/gomod2nix/main.go:6 +0xf
That's it. What it should look like is something like this:
INFO[0000] Parsing go.mod modPath=go.mod
INFO[0000] Downloading dependencies
panic: error generating pkgs: Failed to generate packages in ./ with path gomod2nix.toml: Failed to run 'go mod download --json: exit status 1
go: github.com/go-webauthn/[email protected]: module github.com/go-webauthn/[email protected] requires go >= 1.23 (running go 1.21.4)
This doesn't happen with v1.6.0. You can run it with go run github.com/nix-community/[email protected]