Multiple level modules in a single repo

93 views
Skip to first unread message

itzu...@gmail.com

unread,
Mar 8, 2019, 3:49:36 PM3/8/19
to golang-dev
Trying to make go modules work for the below project structure

go version go1.12 linux/amd64


.
├── bll
│   ├── billing
│   │   ├── details.go
│   │   └── go.mod
│   ├── complaint
│   │   ├── details.go
│   │   └── go.mod
│   └── task
│       ├── details.go
│       └── go.mod
├── go.mod
└── services 
    ├── billing # refers the bll/* to create a service.
    │   ├── go.mod
    │   └── main.go
    ├── complaint # refers the bll/* to create a service.
    │   ├── go.mod
    │   └── main.go
    └── task # refers the bll/* to create a service.
        ├── go.mod
        └── main.go


Already tried solutions for a similar question :

https://github.com/go-modules-by-example/index/tree/master/009_submodules
https://roberto.selbach.ca/intro-to-go-modules/


if the modues are nested as above, how does the git tag(s) change ??? tried bll/task/v0.1.1 and task/v0.1.1 etc. did not work.

error is like:

cannot find module providing package github.com/{name}/{repo}/bll/task

should bll/go.mod services/go.mod be there ? (tried that also , didn't work)

I have seen examples for single level directories, but not for nested ones.

Can you please point out what I am missing ?

Thanks.

Paul Jolly

unread,
Mar 8, 2019, 3:59:46 PM3/8/19
to itzu...@gmail.com, golang-dev
(full disclosure, I wrote
https://github.com/go-modules-by-example/index/blob/master/009_submodules/README.md)

Quick first question: are you absolutely sure you need multiple modules?

https://github.com/golang/go/wiki/Modules#faqs--multi-module-repositories
> --
> You received this message because you are subscribed to the Google Groups "golang-dev" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to golang-dev+...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

Paul Jolly

unread,
Mar 8, 2019, 4:01:09 PM3/8/19
to itzu...@gmail.com, golang-dev
Apologies, I didn't notice this was sent to golang-dev.

Let's move this discussion to golang-nuts, Abhishek:

https://groups.google.com/forum/#!forum/golang-nuts
Reply all
Reply to author
Forward
0 new messages