An example of setting up Go submodules & tagging them.
There are three go.mod
files here:
- The one alongside this README.md (./go.mod)
- The one in the public submodule (./submod/go.mod)
- The one in the CLI being used to demo the two above (./command/go.mod)
If you look in the command one, you'll see that despite these being in the same repo, they are installed independently of one another.
This allows you to store multiple packages with smaller dependency sets as 'sub-modules' of a main Go repository.
To test this for yourself, try running the following:
# Will retrieve the latest version of the root module
go get github.com/hbjydev/go-submods-example
# Will retrieve the latest version of the `submod` module
go get github.com/hbjydev/go-submods-example/submod
They are independently viewable on pkg.go.dev too!