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

Move to go modules #43

Merged
merged 2 commits into from
Jan 14, 2020
Merged

Move to go modules #43

merged 2 commits into from
Jan 14, 2020

Conversation

ferhatelmas
Copy link
Contributor

  • update travis to latest 2 versions
  • put a empty line to internal import and 3rd part dependency

* update travis to latest 2 versions
* put a empty line to internal import and 3rd part dependency
@@ -0,0 +1,10 @@
module github.com/GetStream/stream-go2/v4
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why would we include /v4 to the module name? sounds redundant

Copy link
Contributor Author

@ferhatelmas ferhatelmas Nov 7, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are already 3.x releases and it's a best practice to bump major while introducing modules.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes but why are we adding the version to the name of the module? can't we just create a v4.0.0 tag?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

module github.com/GetStream/stream-go2

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am sure we can find a solution that does not require having version name as part of module and package names; that's ugly

Copy link
Contributor Author

@ferhatelmas ferhatelmas Nov 7, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's the convention of go tool works with major versions.

I think it's not ugly, but explicit.

If you really want to go tag way only, I can update similar to stripe-go but beware not standard in terms of introducing breaking changes.

https://github.com/stripe/stripe-go#go-module-support

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I came across with wrong module support addition without version suffix in the module name.

mholt/archiver#187

should be github.com/mholt/archiver/v4 but it's not so it's breaking and module supported go can only install v3.1.1 - last version before go.mod file was added.

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just passing by (got here via the linked module issue in mholt/archiver), but wanted to note that @ferhatelmas is correct -- Go modules with a major version beyond v1 are required to have the major version as a suffix of their module name per the module specification. See https://github.com/golang/go/wiki/Modules#releasing-modules-v2-or-higher, which discusses this exact scenario (transitioning a repository that is already at v2+ to modules). https://blog.golang.org/v2-go-modules discusses this as well. As noted here, not including the major version as part of the module while having tags that are beyond v0/v1 will result in suboptimal behavior when trying to consume the module (as is currently the case with archiver). Unfortunately this issue/confusion appears to be quite common: golang/go#31543

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@nmiyake thanks for chiming in to give further clarification and links.

Also thanks for the archiver fix 😉

@ferhatelmas
Copy link
Contributor Author

@tbarbugli I'm going forward with this change for better consistency between repositories.

@ferhatelmas ferhatelmas merged commit f0a9698 into master Jan 14, 2020
@ferhatelmas ferhatelmas deleted the go-modules branch January 14, 2020 16:32
@ferhatelmas ferhatelmas mentioned this pull request Jan 16, 2020
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

Successfully merging this pull request may close these issues.

3 participants