command to pre-compile vendor libs

79 views
Skip to first unread message

Harmen

unread,
Apr 30, 2024, 2:35:25 AMApr 30
to golang-nuts
Hi,

in both my Nix and Docker builds I have a step to build all libraries in
/vendor, and then cache that. Works great, saves me multiple minutes for every
CI build.

Now I would like to improve the command, this is what I currently use:

$ go build -v `cat vendor/modules.txt |grep -v '#'|grep -v sys/windows|grep -v tpmutil/tbs|grep -v internal`

In order to keep the cache key valid I can't depend on my own code, I can only
depend on go.{mod,sum} and on what's in /vendor/. The sys/windows and tpmutil/tbs are packages which
have "build constraints exclude all Go files".

It all works fine, just wondering if there's a nicer way to get all
"compilable" packages stored in /vendor.

Thanks!

Anthony Martin

unread,
Apr 30, 2024, 4:48:25 AMApr 30
to Harmen, golang-nuts
Harmen <har...@lijzij.de> once said:
> It all works fine, just wondering if there's a nicer way to get all
> "compilable" packages stored in /vendor.

go list ./vendor/...

Cheers,
Anthony

Harmen

unread,
Apr 30, 2024, 4:53:22 AMApr 30
to Anthony Martin, golang-nuts
> > It all works fine, just wondering if there's a nicer way to get all
> > "compilable" packages stored in /vendor.
>
> go list ./vendor/...

I knew there had to be a simpler way, thanks!
Reply all
Reply to author
Forward
0 new messages