gomod2nix icon indicating copy to clipboard operation
gomod2nix copied to clipboard

question: how to use `mkVendorEnv` in own `buildGoModule`

Open gabyx opened this issue 1 year ago • 1 comments

Hi, I think this flake is great. I would have liked to use mkVendorEnv in my own buildGoModule function which builds our Go package. Can I use this function by importing this flake in my flake and then accessing mkVendorEnv before using my buildGoModule?

Would you mind giving some help on how this would look like?

Thanks a lot.

gabyx avatar Sep 23 '24 11:09 gabyx

It would be cool to provide an external function mkVendorEnv which provides the result here: https://github.com/nix-community/gomod2nix/blob/master/builder/default.nix#L250C7-L250C16

This would then be useful in composing your go.mod -> vendor dir - solution with other customized buildGoModule functions.

I reckon a function

mkVendorEnv =
    { go
    , modulesFile
    , goModFile
    , pwd
    }:

gabyx avatar Sep 23 '24 12:09 gabyx