Go's compatiblity with non-module repositories

137 views
Skip to first unread message

Peter Bočan

unread,
May 22, 2021, 7:06:11 AM5/22/21
to golang-nuts
Hey guys,

I am reading upon the module's compatibility with non-module repositories
https://golang.org/ref/mod#non-module-compat and few things are unclear to me:

It says that Go will synthesize a go.mod file which only contains a module directive and the module that depends on such a repository may need to add indirect dependencies.

For example,  golang.org/x/te...@v0.3.6 depends on golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e which does not have a go.mod file yet the x/test does not have any indirect requirements. What is the guarantee that the dependency graph is complete and the x/text module is not missing any indirect dependencies?

Kindly,
Peter.

Bryan C. Mills

unread,
May 24, 2021, 2:32:58 PM5/24/21
to golang-nuts
The go get command ensures that all packages transitively imported by the named package(s) are provided by some module in the module dependency graph. The go mod tidy subcommand does the same for all packages transitively imported by your module (not just the dependencies of a specific package).

If go mod tidy is a no-nop for your module, then your dependency graph should not be missing any packages, even if your direct dependencies do not specify explicit requirements for them.

Reply all
Reply to author
Forward
0 new messages