3

When you do a release on github for a repo you can do "tags" which makes it easier to track in your go.mod

But submodules (or multiple modules) the existing github release method does not work.

The "main" module will be tagged

But the "submodule" can't be referenced via that tag. (Which makes sense bc they should not be required to be lockstep)

My question is how to get Github to tag that submodule with an explicit version?

Note this is for a "private" repo so I can't publish it as a separate package within golang outside of github

1 Answer 1

2

You can tag versions for each submodule by adding a directory prefix in front of the tag.

So for the following directory structure, you can create this tag submod/subsubmod/v0.0.1

demo/
└── submod
    └── subsubmod
        ├── file.go
        └── go.mod
Sign up to request clarification or add additional context in comments.

4 Comments

This is really helpful! So you make "submod/subsubmod v0.0.1" the "tag" name in the github release gui? (just so I am 100% clear)
Yes. You can even do git tag "submod/subsubmod v0.0.1" and then git push --tags from the terminal. This will tag the repo but not create a release on your GitHub repository. (Tagging is enough for Go though)
it looks like git tag "submod/subsubmod v0.0.1" is not actually valid but git tag "submod/subsubmod/v0.0.1" is
ahh yes, that's my bad

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.