Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

go build keeps complaining that: go.mod has post-v0 module path

Tags:

go

go-modules

Following the release of Go 1.11, I have been trying to move my repositories to Go modules, by adding a go.mod file at their root.

One of my root libraries my.host/root is in its version 17.0.1, so I wrote in its go.mod file:

module my.host/root/v17

I tagged that version v17.0.1 as documented in the Go modules manual.

When I try to make a new Go project that uses my root library, like:

package main

import root "my.host/root/v17"

func main() {
    root.DoSomething()
}

And try to compile it, I get the following error:

go: my.host/[email protected]: go.mod has post-v0 module path "my.host/root/v17" at revision 6bc78016491a

I am at loss figuring out why this happens. I explicitly added v17.0.1 in the go.mod file, yet every attempt at go build replaces the entry with a v0.0.0-20180828034419-6bc78016491a version which then fails because at that commit, the go.mod file module entry of my root library indeed ends with a v17, as it should.

For the record, this commit is the same as the tagged v17.0.1 version.

What am I doing wrong here? How can I debug this situation?

like image 385
ereOn Avatar asked Aug 28 '18 04:08

ereOn


1 Answers

The error I got was: github.com/emicklei/[email protected]: go.mod has post-v0 module path "github.com/emicklei/go-restful/v2" at revision 3658237ded10

Appending github.com/emicklei/go-restful with v2 like so: github.com/emicklei/go-restful/v2 in my go.mod file fixed it for me.

like image 130
djsd123 Avatar answered Nov 16 '22 03:11

djsd123