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

Not able to use msgp with go modules #241

Open
Halfi opened this issue Dec 4, 2018 · 3 comments
Open

Not able to use msgp with go modules #241

Halfi opened this issue Dec 4, 2018 · 3 comments

Comments

@Halfi
Copy link

Halfi commented Dec 4, 2018

Command go get -u -t github.com/tinylib/msgp install msgp from master. It generates code with msgp.WrapError.
But when using msgp in app with go modules, latest version is v1.0.2 and there are no msgp.WrapError. To migrate to version v2 you should use v2 postfix in import path, but I can't modify pregenerated code.
It was broken in commit 1360bda

@philhofer
Copy link
Member

The code doesn't officially support go modules (at the moment).

In either case, the tool and the library that comes with it are bundled together; you must vendor them using the same strategy. The fact that go modules don't recognize this coupling is, IMO, a deficiency in the design of the module system. In any case, maintaining a compatibility matrix of tool and library versions sounds like a huge pain, so I don't see this tool/library supporting that in the future unless someone is willing to sponsor the work. My guess is that the application in question can be fixed if you can encourage the go toolchain to pull the whole project as a dependency.

With that being said, I have been meaning to port this project to modules so that all the dependencies get pulled in correctly. (There's a 'v2' branch I've been patching on and off for a while now.)

TL;DR the library code and code generator are inseparable; the only stability guarantees I am providing are source-level backwards-compatibility and encoding backwards-compatibility. That is, for any existing application, you can upgrade to the new library and code generator, re-generate the code, and everything will continue to work as before.

@Halfi
Copy link
Author

Halfi commented Dec 5, 2018

Still I can use this library, but with one discomfort thing. I have to install msgp with some hack. Install with command go get -u github.com/tinylib/[email protected]. But I can install it only if I have go.mod in the workdir. Looks like in 1.12 it have been fixed (but at now it still beta).

To use v2 the auto generated code should use import like this import "github.com/tinylib/msgp/v2" but it impossible without fixes generator template.

Or you can remove v*.*.* versions, than modules starts use latest master in app.

@philhofer
Copy link
Member

I added the v*.. releases at the request of the Debian folks who package this code. It's disappointing that the Go tool has retroactively added new semantics to those releases.

I will ask the Go folks what advice I should be giving my users.

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

No branches or pull requests

2 participants