As mentioned here one can get all the standard Go packages using https://godoc.org/golang.org/x/tools/go/packages 's Load()
function in which one can give "pattern" as input.
pkgs, err := packages.Load(nil, pattern)
For example, if pattern = "std"
then it returns all the standard packages.
But, if I want to get a list of custom/user-defined packages having custom patterns such as only the vendor folders of the form github.com/X/Y/vendor/...
then how exactly I can specify the pattern?
I have tried using /vendor/
, github.com/X/Y/vendor/
and some other combinations as pattern
in the Load()
function. None of them have worked.