-
Notifications
You must be signed in to change notification settings - Fork 77
Support go modules #39
Comments
This file specifies the require path for go-mail and the v2 branch. Fixes #39
This has broken both modules and According to the It's important that the module name also match the import path for those not currently using modules, which is a lot of people. The suggested route to solve this problem is to create a Please consider either rolling back this change or making the suggested corrections. Thanks. This release has broken https://gobuffalo/buffalo. |
@markbates Apologies for the trouble. What does your
Also, from looking at your commit in gobuffalo/buffalo@95c2e1a, I notice you were using @alexcesaro's (upstream) import path, To use this fork, you'll want to import either:
I'll double check to be sure I'm not making an obvious mistake here. If anyone else can confirm this breakage, we can roll this back. 😅 |
Also, the branch “solution” means no one using non-modules can get it with go get.
It’s your repo and you can’t obviously, support modules the way you want, but it would be nice if you can make it work for everyone.
Thanks.
…On Nov 12, 2018, 12:57 PM -0500, Ivy Evans ***@***.***>, wrote:
@markbates Apologies for the trouble. What does your go version report? From what I read, specifying /v2 should work for branches too:
> Go versions 1.9.7+, 1.10.3+, and 1.11 are able to properly consume and build a v2+ module created using this approach without requiring updates to consumer code that has not yet opted in to modules (as described in the the "Semantic Import Versioning" section above).
Also, from looking at your commit in ***@***.***, I notice you were using @alexcesaro's (upstream) import path, gopkg.in/gomail.v2, and not gopkg.in/mail.v2. Was that intentional?
To use this fork, you'll want to import either:
• github.com/go-mail/mail - This should be the latest HEAD of the v2 branch.
• github.com/go-mail/mail/v2 - If using Go modules, this should be the latest v2.*.* tag.
• gopkg.in/mail.v2 - This should be the latest HEAD of the v2 branch.
I'll double check to be sure I'm not making an obvious mistake here. If anyone else can confirm this breakage, we can roll this back. 😅
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub, or mute the thread.
|
We tried using http://gopkg.in/mail.v2 too, but again, modules and import paths don’t match.
The problem here is there needs to be a single import path that works for non-modules and modules alike. Currently it’s not possible to import this package and have it resolve in both.
They have to match for Go to work. We ended up having to internalize the package as it’s broken.
…On Nov 12, 2018, 12:57 PM -0500, Ivy Evans ***@***.***>, wrote:
@markbates Apologies for the trouble. What does your go version report? From what I read, specifying /v2 should work for branches too:
> Go versions 1.9.7+, 1.10.3+, and 1.11 are able to properly consume and build a v2+ module created using this approach without requiring updates to consumer code that has not yet opted in to modules (as described in the the "Semantic Import Versioning" section above).
Also, from looking at your commit in ***@***.***, I notice you were using @alexcesaro's (upstream) import path, gopkg.in/gomail.v2, and not gopkg.in/mail.v2. Was that intentional?
To use this fork, you'll want to import either:
• github.com/go-mail/mail - This should be the latest HEAD of the v2 branch.
• github.com/go-mail/mail/v2 - If using Go modules, this should be the latest v2.*.* tag.
• gopkg.in/mail.v2 - This should be the latest HEAD of the v2 branch.
I'll double check to be sure I'm not making an obvious mistake here. If anyone else can confirm this breakage, we can roll this back. 😅
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub, or mute the thread.
|
@markbates I understand your frustration and I want to help. A number of users have expressed interest in utilizing Go modules and I'm only supporting it under the condition that it works for everyone. I want to find a solution that works for us all and in order to do that, I need a bit more detail…
I just tried importing go-mail with a pristine
After making sure my project was moved/symlinked into
Is this the same case for you too? Edit: I pasted the wrong |
@markbates It might also help to see the output of |
With mods on (off works fine):
With mods off (mods are fine):
It's easy to reproduce. You just need to pick an import path, and support that one. |
I’m also in my GOPATH as I work exclusively there. This was also reported by other members of the team, the community, Travis, etc...
Trust me when I say this broke stuff for people. This got released and all of a sudden everything came to grinding halt.
You also can’t rever the change now either as go modules will pick up the last release with a go.mod file; so you can’t revert and need to fix the problem head on.
…On Nov 12, 2018, 1:20 PM -0500, Ivy Evans ***@***.***>, wrote:
@markbates I understand your frustration and I want to help. A number of users have expressed interest in utilizing Go modules and I'm only supporting it under the condition that it works for everyone. I want to find a solution that works for us all and in order to do that, I need a bit more detail…
• What go version are you using?
• What exact error messages are you getting?
I just tried importing go-mail with a pristine GOPATH without any trouble. One hiccup I noticed, however was that I needed my project to reside within GOPATH, otherwise I get:
main.go:7:2: cannot find package "gopkg.in/mail.v2" in any of:
/usr/local/Cellar/go/1.11.2/libexec/src/gopkg.in/mail.v2 (from $GOROOT)
/Users/ivy/test/go/src/gopkg.in/mail.v2 (from $GOPATH)
After making sure my project was moved/symlinked into GOPATH, I had no trouble outside of a small warning:
go get: warning: modules disabled by GO111MODULE=auto in GOPATH/src;
ignoring ../../../go.mod;
see 'go help modules'
Fetching https://gopkg.in/mail.v2?go-get=1
Parsing meta tags from https://gopkg.in/mail.v2?go-get=1 (status code 200)
get "gopkg.in/mail.v2": found meta tag get.metaImport{Prefix:"gopkg.in/mail.v2", VCS:"git", RepoRoot:"https://gopkg.in/mail.v2"} at https://gopkg.in/mail.v2?go-get=1
gopkg.in/mail.v2 (download)
gopkg.in/mail.v2
test
Is this the same case for you too?
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub, or mute the thread.
|
I’ve been working closely with members of the Go team on improving modules support, and I’ve brought this ticket to their attention as an experience report. Hopefully it’ll help them with docs and improvement s |
FYI, for a package maintainer, opting into modules for a non-v1 package is a breaking change.
You actually can revert the change in v2 and support modules in v3. @markbates I believe you need to use |
Using go modules, outside GOPATH, it works as expected. It creates the following entry in my go.mod:
No error nor warning during testing or compilation. |
again, this is broken if you want to use the same import path for both mods or non-mods. We’ve internalized the package because this is broken. It’s easy to reproduce in the GOPATH. Pick an import path and support just the one. It’s that simple. I get the impression, from this ticket, that there is no interest in changing that. Again, not my project, so I can’t dictate. I’m moving on from this issue; since we’ve fixed it by vendoring for now. If this gets fixed, we’ll remove the vendor. Please consider fixing this. Considering how easy it is to support both; the fact I’m getting such push back on this, makes me believe that this won’t happen. :( |
I can confirm what @markbates said: buffalo, as a lib importing go-mail/mail, need to support both users using go modules and those who don't, that's why the current solution can't work. |
We are affected by this problem. Please consider to fix it. |
Okay, the fix I'm considering is:
Can anyone sanity check this solution to be sure I don't inadvertantly make things worse? |
v2.3.1 is tagged and removes the |
Snag is @ivy
The new go.mod solves the problem... |
I'm going to assume by the silence that there's no need to yank the previous tag. @pedromorgan Agreed 100%, Gopkg.in is no longer necessary. It's really only around for the small minority of developers who might still rely on v1 and/or an older Go. I'm open to deprecating it. Unfortunately, the go.mod addition created more problems than it solved… |
I believe @dhui is right, it's safe to keep v2 as it is and switch to go modules in v3 that you could start as soon as you can, (even if it's just for that ?). |
It's been a while; let's revisit this. The Go wiki has some guidelines on how to migrate a package to modules that is already on a version >= 2.0: https://github.com/golang/go/wiki/Modules#releasing-modules-v2-or-higher. The general advice they give is to bump up to a new major version (so dep, etc. can stick with their current version), and to either put the new major version on a separate branch or in a subdirectory. Given the stability of this library, I think the major branch approach would be fine, although it would probably prevent dep from importing v3 until golang/dep#1962 is fixed. I can submit a quick PR that adds modules at v3, but the important parts of the process will be outside the scope of the PR:
If you want more info about this process, the wiki link above has links to more resources. |
Support go module versioning conventions and when used don't redirect to gopkg.in/mail.v2
https://github.com/golang/go/wiki/Modules#semantic-import-versioning
The text was updated successfully, but these errors were encountered: