You should tag the version with the path to the module root: for example path/from/root/v1.2.3
On Thu, 2020-11-19 at 18:58 -0800, Victor Denisov wrote: > Hi, > > I've recently encountered an interesting behavior of go modules. > I have a library in a repository on github. The go.mod file for this > library is not in the root directory of the repo. I create a signed > tag in the repo, say v1.2.3. > However when I try referring the full path to the module in the > go.mod of my application that uses this library I can't do it because > go build complains that ref v1.2.3 is not found. > > The line that I specify in my go.mod looks as follows: > github.com/username/reponame/path/from/root v1.2.3 > > However when I don't specify anything in the go.mod of my > application, go build successfully finds the module however it uses > absolute version reference in go.mod > github.com/username/reponame/path/from/root v0.0.0-date-commitid > > Can someone comment on this topic? I'm trying to understand whether > it's ok to have go.mod not in the root directory. Is this behavior > intentional or just a coincidence. > > Thanks in advance, > Victor. > > -- > You received this message because you are subscribed to the Google > Groups "golang-nuts" group. > To unsubscribe from this group and stop receiving emails from it, > send an email to golang-nuts+unsubscr...@googlegroups.com. > To view this discussion on the web visit > https://groups.google.com/d/msgid/golang-nuts/65736f44-901b-435a-990f-7f6ee9dde588n%40googlegroups.com > . -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/golang-nuts/3c1c0d314bc2bd519a06035d940ae4c8ba5ab8c1.camel%40kortschak.io.