The module contains the packages in the directory containing its go.mod file as well as subdirectories of that directory, up to the next subdirectory containing another go.mod file (if any).
Can I have separate modules in both parent and child folders? For example: a/go.mod, a/b/go.mod.
Can I use exported names from child module in parent module?
It also says there “A Go repository typically contains only one module, located at the root of the repository.” And it says here, “if we created a subdirectory world , we would not need to (nor want to) run go mod init there.”
Make your life easier and don’t do that. If your code should be packaged as two modules, house them in separate directory trees. If you have related packages, keep them in one module. Don’t confuse packages and modules. Packages are for organization and namespacing, modules are for distribution and versioning.