dependabot / gomodules-extracted

This code was originally used in dependabot-core, but has since been removed. See Readme for details.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Example usage?

StevenACoffman opened this issue · comments

Hi! I'd like to use this to embed go mod tidy behavior into a golang tool that can help maintain a multi-module monorepo.

For example, when dependabot updates a shared lib's go.mod, the go.sum of all the dependent applications in the same repo (which use a replace directive for the local relative path) then will fail to verify, breaking the build without manual intervention.

I'm not sure if the code using this library is public, but if you have a handy example lying around, I'd really appreciate it!

Oh! By the way, I found updatechecker which is close. Not exactly go mod tidy though, so if you have that example, it would still be helpful.

It looks like runTidy calls modload.LoadPackages so I can just use those same options and call LoadPackages

Oh! I got it working in StevenACoffman/monotidy, but I had to temporarily fork this library and run the extract to update to Go 1.17rc2 to work around a bug where go mod tidy wouldn't update go.sum properly, per golang/go#44129

Thanks for this awesome library, and dependabot in general!

Can this be closed? It doesn't seem actionable any more.

Yes! Thanks!