Hi Nic,

This is actually working as intended, though I don't think we've adequately
documented it. I've sent CL 342531
<https://go-review.googlesource.com/c/website/+/342531> to mention this in
the reference documentation.

In short though, files in a subdirectory that contains a go.mod file are
considered part of a different module, so when you download the module in
the parent directory, the files in that subdirectory are not included.

In many cases, putting multiple Go modules in the same repository can be
counter-intuitive. I'd only recommend it in situations where you have
multiple projects that need to be released and versioned independently. If
the projects are tightly couple and need to be released together it may be
better to have them in one module.

On Mon, Aug 16, 2021 at 9:11 AM Nicholas Bunn <nicholasbun...@gmail.com>
wrote:

> Hi all,
>
> Hoping someone can give me a bit of assistance here. I'm busy refactoring
> a gRPC project of mine so that all proto files are generated into a single,
> "protoFile" directory, instead of having the generated files living under
> the service's directory. My idea is to have the generated files implemented
> as modules, allowing any client to access them from this central location.
>
> The issue I've run into is the "module found ... but does not contain ..."
> one. I've hit this a couple of times before (as anyone new to Go modules
> does, I'm sure) and can usually solve it by cleaning modcache and/or
> re-initialising the modules. However this time the usual solutions haven't
> helped much. I've attempted to implement semantic versioning on my Github
> too, which didn't resolve anything either. Go get fetches the correct
> version of my project directory (github.com/NicholasBunn/mastersCaseStudy),
> but when I check my pkg directory, it's omitted all subfolders that contain
> Go modules (including all go services with a go.mod file).
>
> The project is hosted at github.com/NicholasBunn/mastersCaseStudy, with
> the generated protos living in protoFiles/go. If you'd like to try and
> re-create the issue, cd into
> mastersCaseStudy/services/authenticationService, and run "go mod tidy".
> This service makes use of the generated protos living in
> mastersCaseStudy/protoFiles/go/authenticationService/v1, which has its
> go.mod and go.sum files, but the "go mod tidy" fails on my side with the
> error mentioned above.
>
> Hoping I've just misunderstood something with Go modules and someone here
> can throw me onto the right path again!
>
> Thanks in advance,
> Nic
>
> --
> 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/aa1c413c-f9ab-4be0-822d-4886a37bbdb9n%40googlegroups.com
> <https://groups.google.com/d/msgid/golang-nuts/aa1c413c-f9ab-4be0-822d-4886a37bbdb9n%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/CAGCADbZWkk%3DMz1G_vgU57hnaUd3ONbG4XbzS4p2HO3Gcqe7nqQ%40mail.gmail.com.

Reply via email to