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

go.mod: Import path should end with /v2 #122

Closed
thsnr opened this issue Sep 3, 2018 · 8 comments
Closed

go.mod: Import path should end with /v2 #122

thsnr opened this issue Sep 3, 2018 · 8 comments
Labels

Comments

@thsnr
Copy link

thsnr commented Sep 3, 2018

Acording to the Go modules documentation, if a module version is v2.x.y, then the import path for that modules should end with /v2, i.e. zombiezen.com/go/capnproto2/v2, in order to indicate incompatibility with v1.x.y.

I recognize that go-capnproto2 already solves this problem, since it marks the version incompatibility in the package name itself (go-capnproto vs go-capnproto2). But I thought I would point out this non-standard behavior.

Here are some more details on including the major version in the import path.

@zombiezen
Copy link
Contributor

Agreed. The main busy work is that I need to set up a shim package that points to the new import path (with type aliases etc) so as not to break existing code. This has been on my radar for a while, but thank you for opening an issue.

@zenhack
Copy link
Contributor

zenhack commented Sep 4, 2018

How would a shim package like that work? In particular afaik go doesn't have true type aliases, so if you do:

import (
    pkg1 "zombiezen.com/go/capnproto2"
    pkg2 "zombiezen.com/go/capnproto2/v2"
)

func Foo(msg pkg1.Message) {
     ...
}

func Bar(msg pkg2.Message) {
     Foo(msg)
}

...the statement in the body of Bar won't type check, as there's no way to just re-export Message; the type construct creates a new type. What am I missing?

@zenhack
Copy link
Contributor

zenhack commented Sep 4, 2018

/me remembers search engines exist.

Ah, we do have type aliases! I totally missed when that got added to the language. I have some ideas about other issues then, but sorry for the noise here.

@whisper-bye
Copy link

whisper-bye commented Nov 7, 2018

with go11 mod

import (
"zombiezen.com/go/capnproto2"
)

build *my project*: cannot find module for path zombiezen.com/go/capnproto2

@zenhack
Copy link
Contributor

zenhack commented Nov 7, 2018

@whisper-bye, it works for me, can you provide more detail?

(also this is probably a separate issue, so this ticket may not be the best place...)

@whisper-bye
Copy link

@zenhack thanks for your quick reply, please move to this thread #126

@zenhack
Copy link
Contributor

zenhack commented Dec 13, 2021

I'm tempted to just close this at this point; the v3 branch does this correctly, and we are mostly not working on the v2 branch at this point (I would accept bug fix patches, but active development is all on v3). It doesn't really seem worth the trouble to shuffle around package paths for versions that are in maintenance mode anyway.

@lthibault, how do you feel about this?

@lthibault
Copy link
Collaborator

Agreed. Closing.

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

5 participants