gomod2nix icon indicating copy to clipboard operation
gomod2nix copied to clipboard

Fix symlink builder to recursively walk the vendor directory

Open niklashhh opened this issue 2 years ago • 6 comments

Fixes https://github.com/nix-community/gomod2nix/issues/20

If the new Println is deemed unnecessary, I can remove it.

niklashhh avatar Aug 16 '23 19:08 niklashhh

Friendly bump on this PR. I also ran into this issue which this PR fixes.

JoshVanL avatar Sep 25 '23 10:09 JoshVanL

I am running into that issue as well.

olebedev avatar Oct 04 '23 05:10 olebedev

@niklashhh while we await a maintainer, I too wish to use your branch. Would you please rebase onto master?

dbaynard avatar Oct 26 '23 18:10 dbaynard

Can confirm too this fixes the issue (I rebased on my own fork). Also kudos on replacing a todo block with a single function that does the right thing — it's nice to see some care taken in this sort of thing.

@adisbladis you are listed as the maintainer; would you please arrange for a review?

dbaynard avatar Oct 26 '23 18:10 dbaynard

@dbaynard Thanks for the kind words!

I have updated the branch. Have not tested that everything works as expected though, so please verify before merging!

niklashhh avatar Oct 31 '23 13:10 niklashhh

This is now needed to build AWS SDK v2 (specifically SSO service). Without it, you get an error:

       > vendor/github.com/aws/aws-sdk-go-v2/service/sso/endpoints.go:12:2: cannot find module providing package github.com/aws/aws-sdk-go-v2/internal/endpoints: import lookup disabled by -mod=vendor
       > vendor/github.com/aws/aws-sdk-go-v2/service/sso/endpoints.go:13:2: cannot find module providing package github.com/aws/aws-sdk-go-v2/internal/endpoints/awsrulesfn: import lookup disabled by -mod=vendor

Another clue is that go build works but building in nix fails.

I then changed to https://github.com/batteries-included/gomod2nix/commit/9febec02ae10d88d0bebb7ef3fe1c06f35c98c5d and builds succeeded in nix again.

elliottneilclark avatar Apr 16 '24 15:04 elliottneilclark

@Mic92 could you please review/merge this?

isubasinghe avatar May 30 '24 06:05 isubasinghe

@isubasinghe I don't have the capacity to maintain this and I am not using gomod2nix anywhere. So here we should really identify a new maintainer.

Mic92 avatar May 30 '24 06:05 Mic92

Okay thanks @Mic92 for the update

isubasinghe avatar May 30 '24 06:05 isubasinghe

This patch causes the following panic for discourse_distrust (a go app I am using in my deployment):

symlink error, trying /nix/store/wqn056sx2amxf3qx2x5j695x6ggxb3wb-go_v1.1.4/codec symlink /nix/store/wqn056sx2amxf3qx2x5j695x6ggxb3wb->
symlink error, trying /nix/store/wqn056sx2amxf3qx2x5j695x6ggxb3wb-go_v1.1.4/codec/0_importpath.go symlink /nix/store/wqn056sx2amxf3qx2>
panic: readdirent /nix/store/wqn056sx2amxf3qx2x5j695x6ggxb3wb-go_v1.1.4/codec/0_importpath.go: not a directory

goroutine 1 [running]:
main.populateVendorPath({0xc00017d440, 0x31}, {0xc000181d60, 0x4b})
        /nix/store/ji20l57yzb60rsy2n1v5j06cpars16db-symlink.go:87 +0x285
main.populateVendorPath({0xc000182d50, 0x21}, {0xc00017d380, 0x3b})
        /nix/store/ji20l57yzb60rsy2n1v5j06cpars16db-symlink.go:95 +0x265
main.populateVendorPath({0xc00016b460, 0x1b}, {0xc0000f76c0, 0x35})
        /nix/store/ji20l57yzb60rsy2n1v5j06cpars16db-symlink.go:95 +0x265
main.makeSymlinks({0xc000152000, 0xc00013b0c8?, 0x1ab?}, 0xc000092020?)
        /nix/store/ji20l57yzb60rsy2n1v5j06cpars16db-symlink.go:71 +0x1e5
main.main()
        /nix/store/ji20l57yzb60rsy2n1v5j06cpars16db-symlink.go:52 +0x279

I have no idea how any of this works, will debug further later

bennofs avatar Jul 17 '24 11:07 bennofs