-
Notifications
You must be signed in to change notification settings - Fork 113
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
Creates a virtual package at v3 subdirectory. #66
Conversation
Step 1 in removing go modules opt-in support without breaking any builds.
Copied forward.go implementation to package. I renamed the package identifier to match the folder name... but I'm realizing this breaks the whole idea, so changing to be uuid and deal with the duplicate name. |
works with |
See #65 . |
I tested this change against a trivial "client" (import the All cases were good except importing |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @dylan-bourque. We should update CI to reflect this change, because the builds are failing at the moment. To begin with, we should drop < 1.9 due to type aliases. Secondly, we need to fix the build for 1.9, which is failing because -coverprofile
was only made to accept multiple packages in 1.10. We only need test coverage for the root package anyway, since the /v3
forwarding package has no tests.
Also, the question remains on whether we should set GO111MODULE at all in Travis. Perhaps we should not. It probably doesn't make a difference anyway.
Aside from the little documentation change I suggested, I think things look good.
@@ -19,7 +19,7 @@ | |||
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION | |||
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | |||
|
|||
package v3 | |||
package uuid |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we should leave a note here, for godoc purposes. The note should say that this uuid package consists of forwarding declarations only, and that callers should look at the root godoc (godoc.org/github.com/gofrs/uuid) instead.
One more note. It would have been awesome if we could have copied the tests over to the forwarding package and watched them all pass! But as it stands, the tests rely on quite a few internal details, and this PR is not the place for such a change. That is a matter for another day. |
As we are using aliases to support the creation of a forwarding package to de-virtualize the module import path this limits support of the code to Go 1.9 consumers if they import the non-virtual path.
Coverprofile only supports multi-package in Go 1.10+ and therefore this breaks the CI build when we added the forwarding package. See #66 comment from @acln0. As there are no tests in the alias package that surfaced this issue, we aren't removing any coverage. But it is something to be aware of if another package is added to this repo.
Codecov Report
@@ Coverage Diff @@
## master #66 +/- ##
=======================================
Coverage 98.92% 98.92%
=======================================
Files 4 4
Lines 279 279
=======================================
Hits 276 276
Misses 2 2
Partials 1 1 Continue to review full report at Codecov.
|
Thanks @itsjamie! I think this set of patches is ready now. Usually, I would squash such a set down to a single commit, to end up with a nicer git history, but it's up to you if you want to do it or not. After this is merged, someone should cut and publish v3.2.0. Thanks. |
@itsjamie @acln0 sorry if this is off base (including I might have lost the thread here a bit on this general topic given there have been more than a few comments)... but I had thought the See for example this comment #61 (comment) from Bryan Mills:
|
@@ -16,7 +14,7 @@ env: | |||
before_install: | |||
- go get golang.org/x/tools/cmd/cover | |||
script: | |||
- go test ./... -race -coverprofile=coverage.txt -covermode=atomic | |||
- go test . -race -coverprofile=coverage.txt -covermode=atomic |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just a thought, but is it worth expanding the tests to include an explicit test of the behaviour you're expecting a user to see, with respect to import paths? That suite of tests might also include your expectations on GOPATH vs module mode in Go 1.11.
I think part of the earlier intent of this change was also to encourage people to use For example, slightly older snippet from @acln0:
I don't personally know if that is indeed is still the intent, but if it is the intent, would it make sense to add a quick note to the README to explain something like that? For example, maybe something relatively brief, such as:
Or maybe that is no longer the intent? |
dismissing in view of recent comments about documentation and testing
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would you please be able to squash these commits in to a single one that provides context behind the change in a digestable way?
The truth is I've been a bit detatched from this, and why we're needing to do this to support modules, and so that information would be helpful to me and others. I'm personally a bit annoyed with the idea of having separate folders with code to support package versions, but it's possible we made mistakes earlier that have prompted that.
It'd be good to get this on the radar of those who are championing the usage of modules, because to me it feels like it's been quite painful for us to make this move for such a simple project. Definitely in comparison to dep
, glide
, and a myriad of others.
Part of this need for me is because we're about to take over logrus
, and they have added modules support without a major release. Is it because they omitted /vN
from their go.mod
file? I want to understand what we did wrong, to avoid making the same mistake in the future.
The "break" came from adding `go.mod` then making further changes on the
same major version. That led to inconsistent imports when using `
github.com/gofrs/uuid` vs `github.com/gofrs/uuid/v3`. IMO, the big miss on
the part of the Go team was not loudly calling out that you need to do a
major version bump when opting into modules if your package is already v2+.
And I'm not really a fan of creating subfolders for each version but it's
the only way for module-unaware importers to get semver behavior. I could
get behind doing it for v3 for compatibility during this transition, but
not really going forward.
Re: logrus, if we're taking it over we'll more than likely want to do this
same dance there.
…On Sat, Jan 5, 2019, 9:17 PM Tim Heckman ***@***.***> wrote:
***@***.**** requested changes on this pull request.
Would you please be able to squash these commits in to a single one that
provides context behind the change in a digestable way?
The truth is I've been a bit detatched from this, and why we're needing to
do this to support modules, and so that information would be helpful to me
and others. I'm personally a bit annoyed with the idea of having separate
folders with code to support package versions.
It'd be good to get this on the radar of those who are championing the
usage of modules, because to me it feels like it's been quite painful.
Part of this need for me is because we're about to take over logrus, and
they have added modules support without a major release. Is it because they
omitted /vN from their go.mod file? I want to understand what we did
wrong, to avoid making the same mistake in the future.
/cc @thepudds <https://github.com/thepudds> @myitcv
<https://github.com/myitcv>
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#66 (review)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/AQ9re5nc_RNglpIRXxWlNvJxNA5FabKWks5vAWrMgaJpZM4Y_skU>
.
|
After conversation in the #gofrs Slack, I'm going to close this pull-request in favour of removal of the |
I was confused. |
Step 1 in removing go modules opt-in support without breaking any
builds.