Say I have a package path, "host.org/user/depmodule/pkgdep", which is
the path to a dependency of "host.org/user/repomain/pkgmain". The
go.mod file in host.org/user/repomain will have a line
"host.org/user/depmodule" in the require block. If I want to
programmatically find what the module path is from the package path
"host.org/user/depmodule/pkgdep", how can I do this?

go list -m only works with module paths, so doing `go list -m
host.org/user/depmodule/pkgdep' when I'm in 
host.org/user/repomain/pkgmain gives me:

go list -m: module host.org/user/depmodule/pkgdep: not a known dependency

Is there a way I can use go list to get this information, or a helper
function somewhere that does this? (The go tool must have this capacity
since go get depends on it when grabbing dependencies).

thanks
Dan

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/e52785a3f01ff0d5601cd8a2caf4d3e19af7aac1.camel%40kortschak.io.

Reply via email to