Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

module name in go.mod for v2 #39

Closed
albertjin opened this issue Mar 5, 2019 · 8 comments
Closed

module name in go.mod for v2 #39

albertjin opened this issue Mar 5, 2019 · 8 comments
Labels

Comments

@albertjin
Copy link

It should have v2 in go.mod

module github.com/pierrec/lz4/v2

and then this example works,

import "github.com/pierrec/lz4/v2"

func test() {
    // ...
    text := lz4.NewReader(compressed)
    // ...
}
@albertjin
Copy link
Author

albertjin commented Mar 5, 2019

This leads to more changes and seems incompatible if imported by projects without module enabled. The root cause is because the revision number is not considered with semantic versioning in mind. 😂

I found a simple solution with the following line in go.mod of my project, and it turns out to use the latest lz4 source in git.

require github.com/pierrec/lz4 master

@pierrec
Copy link
Owner

pierrec commented Mar 5, 2019

If you want the latest updates, v2.1.0 does incorporate them.
Doing the following should work:

require github.com/pierrec/lz4 v2.1.0

The go.mod file was setup this way so as not to upset packages that are not modules aware yet.
See issue #33.

@jefferai
Copy link

I realize this was closed but I came here intending to file an issue with the same request and then found this.

Can I request that, although you're looking at backwards compat now, in the Go 1.14 timeframe (at which point only 1.12-1.14 will be supported, and thus all supported versions support modules) you make this change?

@pierrec
Copy link
Owner

pierrec commented Apr 15, 2019

Hello,

I am definitely in favor of doing this change and following the modules naming convention. However, this has to not clash with the usage of this package by users, so would need to consider it when getting to the 1.14 timeframe.

Keeping this issue open as a reminder.

@pierrec pierrec reopened this Apr 15, 2019
@pierrec pierrec added the go1.14 label May 6, 2019
@bcmills
Copy link

bcmills commented Jun 21, 2019

As noted in #33 (comment), the current approach — a v2 major version without a /v2 suffix on the module path — is not supported.

The fact that it appears to work at all today is due to a bug (golang/go#32695), which I am planning to fix for Go 1.13.

@pierrec
Copy link
Owner

pierrec commented Jun 21, 2019

Thanks for the heads up. I agree that it is currently wrong and should be fixed. Need to think about the best way to not upset the packages importing this package though.

@bcmills
Copy link

bcmills commented Jun 21, 2019

For a short-term fix, you could simply remove the go.mod file in the next patch release. (That would at least restore +incompatible compatibility for module-based users while you figure out a more in-depth solution.)

For the longer term, see http://golang.org/wiki/Modules#releasing-modules-v2-or-higher for some more in-depth discussion.

@pierrec
Copy link
Owner

pierrec commented Aug 1, 2019

Removed support for modules in version 2.
New branch for version 3 (v3) supports go modules.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants