hbjydev / go-submods-example

An example of setting up Go submodules & tagging them.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

go-submods-example

An example of setting up Go submodules & tagging them.

What is this?

There are three go.mod files here:

  1. The one alongside this README.md (./go.mod)
  2. The one in the public submodule (./submod/go.mod)
  3. 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

Another Thing

They are independently viewable on pkg.go.dev too!

About

An example of setting up Go submodules & tagging them.

License:Apache License 2.0


Languages

Language:Go 100.0%