It’s an absolute nightmare to publish modules from subdirectories. I gave up for ANTLR and created a new repo with the source code in the root directory.
But the art is that you need to create a tag named with the subdirectory. I was able to make that work until we needed a v{n} tag. Which as far as I can tell, just doesn’t work.
I found that go get will duplicate the entire repo anyway, will create a pseudo tag from the commit, will download after every commit anyway, even if the go source wasn’t updated, and neither was the tag… the list goes on. I looked at the source code for this part of go - it seems the authors wrestle with this on every release. There are open issues around it too. I can see how hairy the issues are and I am surprised this does not come up more often - when I first asked here about it, it was crickets all the way to the bottom. Also, the import will need to have your subdirectories in the path, which looks a bit wonky even if it works.
So basically. Don’t do this as you are doing it, even though, on paper, go does not impose any particular structure on your repo beyond a few basic things such as excluding testdata, internal, and so on.
Keep your go source at the root of the repo and tag that. If you have a choice, keep non-go artifacts in another repo, otherwise place that code in sub-directories, not the go code.
If you have not created a tag, the go will create a pseudo version for you, which is its default. That’s ok, but it’s difficult to know what source level you are at from the git commit hash.
I recommend using git flow methodology to make this stuff easier, though there is nothing forcing you to do so of course.