It's really annoying to deal with when you have private repositories, but try to simply `import RepoB/bar` from ModuleA, and don't bother with the submodule stuff. Module SHAs will replicate submodule functionality in a way that's more compatible with the language.
On Wed, Mar 31, 2021 at 1:46 PM 'Axel Wagner' via golang-nuts < golang-nuts@googlegroups.com> wrote: > AIUI, if you nest modules (that is, a subdirectory of a module containing > a directory with its own `go.mod`), the "inner" module is not considered > part of the "outer" module. In particular, it would also not be included in > the module zip (which is the primary way modules are distributed - *not* as > repositories). > > So, AIUI, `foo/baz/bar` is technically a valid import path, but it's not > "inside" module `foo`, so to speak. > > On Wed, Mar 31, 2021 at 9:46 PM cpu...@gmail.com <cpui...@gmail.com> > wrote: > >> Consider this layout: >> >> >> - Repo A contains module foo >> - Repo B contains module bar (of course ;) >> - Repo B is added as submodule to repo A at /baz >> >> >> I was expecting that I can >> >> import "foo/baz/bar" >> >> in repo A, but that leads to error ("no required module provides >> package..."). >> >> Shouldn't this work as the import path is a perfectly valid import path >> inside module foo? >> >> Cheers, >> Andi >> >> -- >> 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/1f2bab6e-47cf-4f80-9a66-3a8bad2869ban%40googlegroups.com >> <https://groups.google.com/d/msgid/golang-nuts/1f2bab6e-47cf-4f80-9a66-3a8bad2869ban%40googlegroups.com?utm_medium=email&utm_source=footer> >> . >> > -- > 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/CAEkBMfEbky861b0h%2B0SaRh13by3DtmpnrRTqjnAjT1wQ_CZkEg%40mail.gmail.com > <https://groups.google.com/d/msgid/golang-nuts/CAEkBMfEbky861b0h%2B0SaRh13by3DtmpnrRTqjnAjT1wQ_CZkEg%40mail.gmail.com?utm_medium=email&utm_source=footer> > . > -- 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/CA%2Bv29LuRF_iL-gXoGqn%2Bk%3Dw_wv%2BU_0eeYpTTHYETvzkj%3D4ujHQ%40mail.gmail.com.