blackfriday icon indicating copy to clipboard operation
blackfriday copied to clipboard

v2 go module name wrong?

Open andig opened this issue 4 years ago • 4 comments

Coming from https://github.com/cpuguy83/go-md2man/issues/43 and https://github.com/golang/go/issues/34165 my feeling is that the module versioning for this repo might be broken.

Given that v2 changes the import path, the /v2 should be appended to the module name as in https://github.com/rsc/quote/blob/master/v3/go.mod. In master at https://github.com/russross/blackfriday/blob/master/go.mod#L1 this is currently not the case?

andig avatar Sep 09 '19 18:09 andig

I am also facing the same issue, any update on this?

4j4y avatar Sep 10 '19 08:09 4j4y

Citing from https://github.com/golang/go/wiki/Modules#releasing-modules-v2-or-higher, it seems this is- as assumed- not correctly implemented as per go expectations:

There are two alternative mechanisms to release a v2 or higher module....

Major branch: Update the go.mod file to include a /v3 at the end of the module path in the module directive...

Major subdirectory: Create a new v3 subdirectory (e.g., my/module/v3) and place a new go.mod file in that subdirectory. The module path must end with /v3. Copy or move the code into the v3 subdirectory...

~~Neither of which is implemented here.~~

Update actually not true. v2 is in a separate branch. At this point I'm confused why this is currently broken.

andig avatar Sep 10 '19 15:09 andig

@andig The module with module path github.com/russross/blackfriday has the following release versions published:

  • v1.5.1
  • v1.5.2
  • v2.0.0+incompatible

You can see it for yourself by running:

$ GO111MODULE=on GOPROXY=direct GOPATH=$(mktemp -d) go list -m -versions github.com/russross/blackfriday 2>/dev/null
github.com/russross/blackfriday v1.5.1 v1.5.2 v2.0.0+incompatible

v1.5.2 works well, but if you try to update to a newer version, you'll get v2.0.0+incompatible, which is incompatible, and will not work. This is unfortunate. We published v2.0.0+incompatible unintentionally, and can't unpublish it now.

The module with module path github.com/russross/blackfriday/v2 has the following release versions published:

  • v2.0.0
  • v2.0.1

You can see it for yourself by running:

$ GO111MODULE=on GOPROXY=direct GOPATH=$(mktemp -d) go list -m -versions github.com/russross/blackfriday/v2 2>/dev/null
github.com/russross/blackfriday/v2 v2.0.0 v2.0.1

v2.0.0 is broken and cannot be used. v2.0.1 works well.

Hope this helps explain the current situation.

dmitshur avatar Sep 22 '19 21:09 dmitshur

Thank you, that explains it. It seems though that at this time there is nothing that v1 users can do to avoid pulling in the incompatible 2.0 when upgrading their dependencies. Only way forward I see is upgrading to v2. This hurts e.g. spf13/cobra/doc.

andig avatar Sep 23 '19 06:09 andig