Get a list of packages from a module

We have a go module we use with lots of packages in it.
e.g.

go list github.com/myco/bigmodule/...
github.com/myco/bigmodule
github.com/myco/bigmodule/pkg1
github.com/myco/bigmodule/pkg2
github.com/myco/bigmodule/suspkg
github.com/myco/bigmodule/pkg4

In our case that list is about 50 packages long. There is a package there that is problematic and we want to search over all our repos for uses of that particular package.

I can do go list -m all to see if a repo is using the big module or not.
But I need to find out if the repo is using a specific package.

Ie. is this repo using this package:
github.com/myco/bigmodule/suspkg

I am hoping for a way that does not involve searching the entire source tree.

Is there a way go list can return the specific packages in use?

If the code is public then pkg.go.dev has a list of imported by.

Here is one of my libraries: https://pkg.go.dev/github.com/ncw/directio?tab=importedby

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.