Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

panic: error generating pkgs #172

Open
tim-goto opened this issue Oct 14, 2024 · 3 comments
Open

panic: error generating pkgs #172

tim-goto opened this issue Oct 14, 2024 · 3 comments

Comments

@tim-goto
Copy link

tim-goto commented Oct 14, 2024

Hey, thanks for the great tool :) Unfortunately I have an issue creating the toml file for this repo. To reproduce:

git clone https://github.com/veertuinc/anklet.git
pushd anklet
nix shell github:nix-community/gomod2nix
gomod2nix generate

results in this output:

INFO[0000] Parsing go.mod                                modPath=go.mod
INFO[0000] Downloading dependencies
panic: error generating pkgs: exit status 1

goroutine 1 [running]:
github.com/nix-community/gomod2nix/internal/cmd.generateFunc(0xb23dc0?, {0xb5a2c8?, 0x0?, 0x0?})
        /build/source/internal/cmd/root.go:67 +0x416
github.com/spf13/cobra.(*Command).execute(0xb23dc0, {0xb5a2c8, 0x0, 0x0})
        /build/source/vendor/github.com/spf13/cobra/command.go:987 +0xaa7
github.com/spf13/cobra.(*Command).ExecuteC(0xb23ae0)
        /build/source/vendor/github.com/spf13/cobra/command.go:1115 +0x417
github.com/spf13/cobra.(*Command).Execute(...)
        /build/source/vendor/github.com/spf13/cobra/command.go:1039
github.com/nix-community/gomod2nix/internal/cmd.Execute()
        /build/source/internal/cmd/root.go:124 +0x25
main.main()
        /build/source/main.go:6 +0x17

do you have any idea what might be wrong here? Thanks!

EDIT: I have checked the other issues I could find for this error but the patch version is defined in the go.mod and everything else wasn't applicable

@JackoCoolio
Copy link

This flake is pretty outdated (nix flake update was last run two years ago) so the go version that it uses to download dependencies is 1.18.4, which has this issue. #143 updates the flake inputs and has been ready to merge for 10 months - @marcusramberg, could that be merged (and updated again since it's 10 months old)?

@acaloiaro
Copy link

acaloiaro commented Dec 14, 2024

Ultimately, this issue has to do with older versions of go requiring the go version in go.mod to be of a specfic form (e.g. go 1.23.0), which is no longer required of newer go versions. When the old go used by gomod2nix encounters go.mod dependency versions in the new format (e.g. go 1.23), it chokes. That causes gomod2nix to choke.

Workaround: If your project specifies its go version in the form 1.23, change it to 1.23.0.


Unfortunately since this issue was opened last year, the PR fixing it now has conflicts: #143.

@JonathanLorimer Will need to re-sync their branch with upstream and resolve conflicts, or anyone can open a PR updating gomod2nix's locked nixpkgs version, which will cause it to use a newer go. I'm not familiar enough with this package to know whether updating all of nixpkgs will affect versions of other things that'll have ill effects.


Perhaps more importantly gomod2nix could consider its strategy for updating its nixpkgs lock. It's currently pointing at a version from 2022. It seems sensible to update nixpkgs when cutting new releases. Maybe @marcusramberg could chime in here?

@i-am-logger
Copy link

i already had 1.23.0
this fixed it for me:

    gomod2nix.inputs.nixpkgs.follows = "nixpkgs";

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants